Advanced Reading #kubernetes #kubectl #devops

Reading Kubernetes Events & Logs

5 exercises on reading kubectl get events and kubectl describe output — understand ImagePullBackOff, CrashLoopBackOff, OOMKilled, and what each event means for pod health.

Key Kubernetes pod states to know
  • ImagePullBackOff — cannot pull the container image (wrong tag, 401 auth, registry down)
  • CrashLoopBackOff — container keeps crashing; Kubernetes retries with exponential back-off
  • OOMKilled / Exit 137 — container exceeded its memory limit; killed by the Linux kernel
  • Normal vs. Warning events — Warning = something unexpected; investigate
  • Restart Count — how many times the container has been restarted; high = ongoing problem
0 / 5 completed
1 / 5
kubectl get events output
$ kubectl get events -n production --sort-by='.lastTimestamp'

LAST SEEN   TYPE      REASON              OBJECT                          MESSAGE
2m          Normal    Scheduled           pod/api-server-7d9b4c6f8-xk2p9  Successfully assigned production/api-server-7d9b4c6f8-xk2p9 to node-3
2m          Normal    Pulling             pod/api-server-7d9b4c6f8-xk2p9  Pulling image "registry.example.com/api-server:v2.4.0"
90s         Warning   Failed              pod/api-server-7d9b4c6f8-xk2p9  Failed to pull image "registry.example.com/api-server:v2.4.0": rpc error: code = Unknown desc = failed to pull and unpack image: failed to resolve reference "registry.example.com/api-server:v2.4.0": unexpected status code 401 Unauthorized
90s         Warning   Failed              pod/api-server-7d9b4c6f8-xk2p9  Error: ErrImagePull
45s         Warning   BackOff             pod/api-server-7d9b4c6f8-xk2p9  Back-off pulling image "registry.example.com/api-server:v2.4.0"
45s         Warning   Failed              pod/api-server-7d9b4c6f8-xk2p9  Error: ImagePullBackOff
Read the kubectl get events output. What is the root cause of the ImagePullBackOff status on the pod?