How can you view the logs of a specific node in K8S?
To view the logs of a specific node, you can follow these steps:
- Firstly, use the command kubectl get nodes to obtain a list of all nodes in the cluster.
- Choose the node you want to view logs for, and use the command “kubectl describe node
” to see detailed information about that node. - In the node’s detailed information, locate the value of the kubeletEndpoint field, which specifies the address and port number of the node’s kubelet service.
- “Using the kubelet service address and port obtained in the previous step, use the following command to retrieve the logs for that node:”
- Retrieve the logs from the Kubernetes node specified by
using HTTPS for communication with the kubelet API and the specified kubelet port, optionally specifying the namespace as . - The
is the name of the node to view the logs from, and is the port number of the kubelet service. The –namespace parameter is optional; it can be specified if the desired namespace is not kube-system. - To view the logs of a node named node-1, use the following command:
- Retrieve the logs of node-1 in the kube-system namespace using HTTPS and port 10250.
- Please note that the above command requires administrative privileges for the cluster.