All exams← All Certified Kubernetes Administrator (CKA) notes

Cluster Component Troubleshooting: Certified Kubernetes Administrator (CKA) revision notes

Revision notes

## Cluster Component Troubleshooting

Troubleshooting Kubernetes cluster components requires a systematic approach, often starting with identifying the affected component and then examining its logs, status, and configuration. The primary components include the Control Plane (kube-apiserver, etcd, kube-scheduler, kube-controller-manager) and Worker Node components (kubelet, kube-proxy, container runtime).

Control Plane Components

  • `kube-apiserver`: This is the central hub. If it's down, `kubectl` commands will fail.
  • Diagnosis: Check `systemctl status kube-apiserver`, `journalctl -u kube-apiserver`, and its static pod logs (e.g., `/etc/kubernetes/manifests/kube-apiserver.yaml` if deployed as a static pod). Look for network issues, certificate problems, or etcd connectivity errors.
  • `etcd`: The cluster's backend store. If `etcd` is unhealthy or unreachable, the API server cannot function.
  • Diagnosis: Use `etcdctl --endpoints=<etcd-ip>:2379 member list` and `etcdctl --endpoints=<etcd-ip>:2379 endpoint health`. Check `systemctl status etcd` and `journalctl -u etcd`. Ensure the data directory (`--data-dir`) is accessible and not full.
  • `kube-scheduler`: Responsible for assigning pods to nodes. If down, new pods will remain in `Pending` state.
  • Diagnosis: Check `systemctl status kube-scheduler` and `journalctl -u kube-scheduler`. Look for errors related to API server connectivity or resource constraints.
  • `kube-controller-manager`: Runs various controllers (e.g., Node, Replication, Endpoint). If down, many cluster operations (like creating services, managing endpoints) will fail or be delayed.
  • Diagnosis: Check `systemctl status kube-controller-manager` and `journalctl -u kube-controller-manager`. Similar to the scheduler, look for API server connectivity issues.

Worker Node Components

  • `kubelet`: The agent that runs on each node, responsible for registering the node and managing pods.
  • Diagnosis: Check `systemctl status kubelet` and `journalctl -u kubelet`. Look for errors related to container runtime connectivity, CNI issues, or incorrect `--register-node` configuration. A node might appear `NotReady` if `kubelet` is unhealthy.
  • `kube-proxy`: Maintains network rules on nodes, enabling communication to pods and services.
  • Diagnosis: Check `systemctl status kube-proxy` and `journalctl -u kube-proxy`. Verify `iptables -L -t nat` or `ipvsadm -L` rules. Issues often manifest as service connectivity problems.
  • Container Runtime (e.g., `containerd`, `Docker`): Responsible for running containers.
  • Diagnosis: Check `systemctl status containerd` (or `docker`) and `journalctl -u containerd`. Pods will fail to start or remain in `ContainerCreating` if the runtime is unhealthy. Use `crictl ps` (for `containerd`) or `docker ps` to verify running containers.

General Troubleshooting Steps

1. Check Logs: Always start with `journalctl -u <component>` or `kubectl logs -n kube-system <pod-name>`.

2. Check Events: `kubectl get events -A` can provide high-level insights into what's failing.

3. Resource Usage: Ensure components have sufficient CPU/memory.

4. Networking: Verify connectivity between components (e.g., API server to etcd, kubelet to API server). Use `netstat`, `ss`, `ping`, `curl`.

5. Certificates: Ensure all components have valid and correctly configured TLS certificates.

Key facts

Flashcards

What is the primary indicator that the `kube-apiserver` might be down?
`kubectl` commands fail to connect to the cluster.
tap to reveal
How do you check the health of `etcd` members from the command line?
`etcdctl --endpoints=<etcd-ip>:2379 member list` and `etcdctl --endpoints=<etcd-ip>:2379 endpoint health`.
tap to reveal
What is the most common symptom if the `kube-scheduler` is not functioning correctly?
New pods remain in the `Pending` state indefinitely.
tap to reveal
Which command is typically used to check the status and logs of a systemd-managed Kubernetes component on a node?
`systemctl status <component>` and `journalctl -u <component>`.
tap to reveal
A node is showing `NotReady`. Which component is most likely having issues on that node?
The `kubelet` agent.
tap to reveal
What is the role of `kube-proxy` and what common tool does it use to implement its function?
`kube-proxy` maintains network rules for service communication, primarily using `iptables` (or `ipvs`).
tap to reveal
If pods are stuck in `ContainerCreating` state, which component should you investigate on the node?
The container runtime (e.g., `containerd` or `Docker`).
tap to reveal
How can you view cluster-wide events that might indicate component failures or issues?
`kubectl get events -A`.
tap to reveal
Practice questions

Cluster Component Troubleshooting: 5 practice questions

Q1. A worker node in your cluster is reporting a `NotReady` status. You have SSH access to the node. What is the most likely first command you should run on the node to diagnose the problem?
  • A.  journalctl -u kube-apiserver
  • B.  kubectl get pods -A
  • C.  etcdctl endpoint health
  • D.  systemctl status kubelet
Show answer & explanation
✓ Answer: D. systemctl status kubelet
The kubelet is the primary agent on a node that communicates its status to the control plane. If the kubelet service is not running, the node will report as NotReady.
Q2. A pod is unable to resolve the DNS name of a Kubernetes Service within the same namespace. Pods on other nodes can resolve it successfully. Which component is most likely misconfigured or failing?
  • A.  etcd
  • B.  CoreDNS pods
  • C.  kube-proxy on the affected node
  • D.  kube-apiserver
Show answer & explanation
✓ Answer: B. CoreDNS pods
CoreDNS is responsible for in-cluster DNS resolution. If a pod cannot resolve a service name, investigating the CoreDNS pods and their logs is the correct first step.
Q3. The `kube-apiserver` is responding slowly and its logs show 'context deadline exceeded' errors when communicating with the data store. Which command would be most effective for checking the health of the underlying data store from a control plane node?
  • A.  ETCDCTL_API=3 etcdctl endpoint health --cacert <ca> --cert <cert> --key <key>
  • B.  ETCDCTL_API=3 etcdctl member list
  • C.  systemctl status etcd
  • D.  kubectl get componentstatuses
Show answer & explanation
✓ Answer: A. ETCDCTL_API=3 etcdctl endpoint health --cacert <ca> --cert <cert> --key <key>
This command directly checks the health and latency of each etcd member endpoint, which is crucial when the API server has trouble communicating with it.
Q4. You have created a new Deployment, but all of its pods are stuck in the `Pending` state. Running `kubectl describe pod <pod-name>` shows no events related to resource pressure or node affinity. Which control plane component is most likely responsible for this issue?
  • A.  kube-scheduler
  • B.  kube-proxy
  • C.  containerd
  • D.  kube-controller-manager
Show answer & explanation
✓ Answer: A. kube-scheduler
The kube-scheduler is responsible for assigning pods to nodes. If it's not running or cannot find a suitable node, pods will remain in the Pending state indefinitely.
Q5. When running `kubectl get nodes`, you receive an error: 'Unable to connect to the server: x509: certificate has expired or is not yet valid'. Which component's certificate is most likely the cause of this issue?
  • A.  The etcd server certificate
  • B.  The kubelet client certificate on a worker node
  • C.  The default service account token
  • D.  The kube-apiserver serving certificate
Show answer & explanation
✓ Answer: D. The kube-apiserver serving certificate
The API server presents a serving certificate to all clients, including kubectl. An expired serving certificate will cause this x509 error for all clients attempting to connect.
Test yourself
See the Certified Kubernetes Administrator (CKA) page

More Certified Kubernetes Administrator (CKA) topics