Pcornel
Containers · Container Troubleshooting

CrashLoopBackOff

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

Back to the Topic

Answer

CrashLoopBackOff means a container keeps exiting and Kubernetes waits longer before each restart.

Remember

The cause is in the previous container's logs and exit code: app error (1), misconfiguration, missing config/secret, OOMKilled (137), failing liveness probe.

First checks

  • 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 debug api-7f… -it --copy-to=api-debug --container=api -- sh
kubectl logs --previous

Verify in this order

container starts → exits → backoff → restart

Where it usually breaks

A wrong command or missing configuration file exits immediately.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6157

Confirmation

Confirm action

Continue?