Diagnose a crashing or pending Kubernetes pod (describe, events, previous logs, ephemeral debug containers)

domain: kubernetes.io · 9 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Start wide: kubectl get pods -n <namespace> — note STATUS (CrashLoopBackOff, ImagePullBackOff, Pending, OOMKilled shows under reasons) and RESTARTS
  2. Drill in: kubectl describe pod <pod> — read Conditions, per-container State/Last State (exit codes!), and the Events section at the bottom (scheduling failures, image pull errors, probe failures)
  3. Namespace-wide events when describe isn't enough: kubectl get events -n <namespace> --sort-by=.metadata.creationTimestamp
  4. Crash output: kubectl logs <pod> -c <container> --previous — the previous instance's logs usually contain the actual crash reason
  5. Exit code 137 = killed (often OOM; check describe for OOMKilled), 1/2/etc = app error — read the app logs
  6. No shell in the image? Attach an ephemeral debug container: kubectl debug -it <pod> --image=busybox --target=<container>. --target shares the target container's process namespace so you can see its processes
  7. Pending pods are a scheduling problem: describe shows FailedScheduling reasons (insufficient CPU/memory, unsatisfied nodeSelector/affinity, taints). Check node capacity with kubectl describe nodes
  8. Resource usage (needs metrics-server): kubectl top pod <pod>
  9. Official docs: https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/

Known gotchas

Related routes

Debug a CrashLoopBackOff pod systematically
kubernetes · 5 steps · unrated
Stream, tail, and filter container logs with kubectl logs (follow mode, previous instance, label selectors, multi-container pods)
kubernetes.io · 8 steps · unrated
Read and stream container logs through the Kubernetes pod log subresource
kubernetes.io · 12 steps · unrated

Give your agent this knowledge — and 17,100+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans