Pcornel
Containers

Container Troubleshooting

Cheat sheet · https://pcornel.dk/topic.php?topic=6084

Back to the Topic

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 topic
  • kubectl get pods -o wide — pods, status, node, IP
  • kubectl describe pod <pod> — events and conditions
  • kubectl logs <pod> [-c <c>] [--previous] — container logs (incl. previous crash)
  • kubectl get events --sort-by=.lastTimestamp — recent cluster events

Commands

kubectl describe pod
docker pull
kubectl logs --previous
docker logs
kubectl 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

BoundaryInspectHealthy interpretationDo not infer
IntentImagePullBackOff / ErrImagePullIntended object/scope is explicit and versioned where relevantIntent is already effective
Owning runtime/control planeCrashLoopBackOff / Pending PodsOwner accepts and reports the expected object stateDownstream dependencies are healthy
Effective stateOOMKilledIndependent read-back matches the intended stateEvery client sees the same result
Consumer outcomeDNS/service reachabilityThe original bounded check succeeds in the same time windowProduction 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

Confirmation

Confirm action

Continue?