Container Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=6084
Answer
Container troubleshooting follows the pod lifecycle: scheduling, image pull, container start, probes and runtime behaviour, using status, events, logs and exec.
Remember
Read status and events first (describe), then logs (--previous for crashes), then exec into the container. Typical states: Pending, ImagePullBackOff, CrashLoopBackOff, OOMKilled, not Ready.
First checks
kubectl get pod— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
Commands
kubectl describe poddocker pullkubectl logs --previousdocker logskubectl get endpointslices
Verify in this order
schedule → pull → start → probes → running
Where it usually breaks
The biggest diagnostic errors are restarting before capturing the original reason, assuming CrashLoopBackOff is the root cause rather than backoff behavior, treating Pending as a runtime failure, or widening permissions/network policy without proving that layer is responsible.
Container Troubleshooting verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | ImagePullBackOff / ErrImagePull | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | CrashLoopBackOff / Pending Pods | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | OOMKilled | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | DNS/service reachability | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6084