Kubernetes errors, decoded

ExplainedKubernetesDevOps, Hands OnBy Cloud Hands On

What each common pod and node error means, where to look first, and the usual fix.

Kubernetes tells you a lot if you know where to look. Start with kubectl get pods for the reason, then kubectl describe pod for events, then kubectl logs --previous for what the app said before it died. For nodes, kubectl describe node shows conditions and taints.

Most errors fall into four groups: can't get the image (ImagePullBackOff, ErrImagePull), can't build the container (CreateContainerConfigError, CreateContainerError), can't start or keep it running (RunContainerError, CrashLoopBackOff, OOMKilled), and can't place it (Pending: no node fits, or the node is NotReady or under pressure).

Cost. Free to learn; practise each error on a kind cluster.

Use it when

How it works

ImagePullBackOff / ErrImagePull
Wrong image name or tag, private registry without access, or rate limits. Check events for the exact pull error.
CreateContainerConfigError
A ConfigMap, Secret or key the pod refers to is missing. Create it or fix the name.
CreateContainerError
The runtime couldn't create the container: name clash, bad mount or missing command. Read the event message.
RunContainerError
Created but couldn't start: entrypoint not found in the image, permissions, or a bad volume. Check command and image.
CrashLoopBackOff
Starts then exits, again and again. Read logs --previous and the exit code.
OOMKilled
Went over its memory limit (exit 137). Raise the limit or fix the leak.
Pending
No node fits (requests, affinity, taints) or volumes can't bind. Read the scheduler's event.
NotReady / DiskPressure
Node problem: kubelet, runtime, network, memory or disk. Describe the node, then cordon and drain if needed.

Options

Fix the YAML
Most config errors: names, keys, image tags, resources.
Fix the image
Missing binaries, wrong entrypoint, wrong architecture.
Fix the node
Disk, memory, kubelet or network problems.

Example. On her first on-call week at Tollmere Logistics, Priya Nair kept this order: get, describe, logs --previous. It took her straight to a missing Secret key (CreateContainerConfigError) and an OOMKilled worker, without restarting anything first.

Don't confuse it with

Exit code 137
Killed (usually OOMKilled, or failed liveness).
Exit code 1
The app itself exited with an error: read its logs.

Words to know

Exit code 137
The process was killed with SIGKILL, often by the out-of-memory killer.
Back-off
Waiting longer between each retry (up to 5 minutes for restarts).

Where to look

  1. kubectl get pods
  2. kubectl describe pod
  3. kubectl logs --previous

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going