Cheat sheets
Troubleshooting flow
Symptoms to first commands to likely causes, plus the file paths and ports to know by heart for the CKA troubleshooting domain.
Symptom to first command
| Symptom | First commands | Usual causes |
|---|---|---|
kubectl refused or times out | On the control plane: sudo crictl ps -a, sudo crictl logs <id>, ls /etc/kubernetes/manifests | API server manifest typo, wrong port, expired cert, etcd down |
Node NotReady | systemctl status kubelet, journalctl -u kubelet -n 50, systemctl status containerd | Kubelet stopped, bad config.yaml, runtime down, CNI missing, expired cert |
Pod Pending | k describe pod Events | Insufficient CPU or memory, untolerated taint, nodeSelector, unbound PVC, scheduler down |
ContainerCreating for long | k describe pod | Missing ConfigMap, Secret or PVC, CNI error |
ImagePullBackOff | k describe pod | Wrong name or tag, private registry without imagePullSecrets |
CrashLoopBackOff | k logs --previous, k describe pod | Bad command, config, dependency, OOM |
OOMKilled, exit 137 | k describe pod | Memory limit too low |
Running but READY 0/1 | k describe pod, probe settings | Failing readiness probe |
| Service unreachable | k get ep,endpointslices, k get svc -o wide | Selector mismatch, wrong targetPort, NetworkPolicy |
| Name does not resolve | k run t --rm -it --image=busybox:1.36 -- nslookup svc, k logs -n kube-system -l k8s-app=kube-dns | CoreDNS down, policy blocks 53 |
kubectl top fails | k get apiservice v1beta1.metrics.k8s.io, k get pods -n kube-system | metrics-server missing or not Ready |
| Deployment makes no Pods | k get rs, controller-manager logs | Controller manager down |
| New Pods never scheduled, no events | k get pods -n kube-system, scheduler manifest | Scheduler down or its manifest broken |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Application error |
| 126, 127 | Command not executable, command not found |
| 137 | SIGKILL: OOM kill or forced kill |
| 143 | SIGTERM: normal termination |
Paths
| Path | Holds |
|---|---|
/etc/kubernetes/manifests/ | Static Pod manifests of the control plane and etcd |
/etc/kubernetes/pki/, pki/etcd/ | CA and component certificates |
/etc/kubernetes/{admin,kubelet,scheduler,controller-manager}.conf | Component kubeconfigs |
/var/lib/kubelet/config.yaml | Kubelet configuration |
/var/lib/kubelet/pki/ | Kubelet client and serving certificates |
/var/lib/etcd | etcd data on a kubeadm node |
/etc/cni/net.d/, /opt/cni/bin/ | CNI config and binaries |
/var/log/pods/, /var/log/containers/ | Container logs on the node |
/etc/containerd/config.toml | containerd configuration |
Node-level tools
journalctl -u kubelet -f, systemctl restart kubelet, crictl ps -a, crictl logs <id>, crictl pods,
crictl inspect <id>, openssl x509 -noout -dates -in <crt>, kubeadm certs check-expiration.
Rules of thumb
- Read the Events (
describe) before the logs, and the previous logs before the current ones. - A Pod you cannot explain: check labels, selectors, taints, quotas and PVCs, in that order.
- Fix the manifest, not the Pod. Static Pods recreate themselves from their file.
- Verify the way a grader would. Test traffic from a temporary Pod in the right namespace.