Error fixKubernetes · 3 min read · Updated 4 Dec 2026

Kubernetes CrashLoopBackOff: Causes and How to Fix It

CrashLoopBackOff means your container starts, crashes and Kubernetes keeps restarting it. Find the real cause with logs and describe, then fix it step by step.

QUICK ANSWERCrashLoopBackOff means the container starts, exits, and the kubelet keeps restarting it with a growing delay (10s, 20s, 40s, up to 5 minutes). It is a symptom, not the cause. Run kubectl logs <pod> --previous and kubectl describe pod <pod> to see why the container exits, then fix that: a crashing app, a wrong command, a missing config or secret, a failing liveness probe or too little memory.
Kubernetes CrashLoopBackOff: common causes and fix steps
Kubernetes CrashLoopBackOff: common causes and fix steps

What CrashLoopBackOff actually means

A pod in CrashLoopBackOff is not stuck. Kubernetes did its job: it pulled the image, started the container, and the process inside exited. Because the pod has restartPolicy: Always (the default for Deployments), the kubelet starts it again, and each time it waits longer before the next try. That wait is the "back-off".

So the question is never "why is Kubernetes doing this?" but "why does my container exit?" The answer is almost always in the container logs or in the pod events.

The most common causes

CauseWhat you seeWhere to look
App error on start-upStack trace, "connection refused", "file not found"kubectl logs <pod> --previous
Wrong command or argsExit code 127 (command not found) or 126kubectl describe pod → Last State
Missing ConfigMap / Secret / env varApp says a setting is missing; or CreateContainerConfigError firstPod spec and kubectl get cm,secret
Liveness probe failsEvents: "Liveness probe failed", container killedkubectl describe pod → Events
Out of memoryLast State: OOMKilled, exit code 137kubectl describe pod
Process finishes and exitsExit code 0, then restartedThe image runs a one-off script, not a server

How to fix it, step by step

  1. See the status and restart count: kubectl get pods (RESTARTS keeps going up).
  2. Read the logs of the crashed run, not the current one: kubectl logs <pod> --previous (add -c <container> if the pod has more than one container).
  3. Check the exit code and reason: kubectl describe pod <pod> and look at Last State (Error, OOMKilled, Completed) and the Events at the bottom.
  4. Exit code 1 or a stack trace: fix the application error (bad config, database not reachable, missing file). Test the image locally with docker run and the same environment variables.
  5. Exit code 127 / 126: the command in command: or args: is wrong or not executable. Compare it with the image's ENTRYPOINT and CMD.
  6. Exit code 137 with OOMKilled: raise resources.limits.memory or fix the memory leak.
  7. Probe failures: give the app time to start with a startupProbe or a larger initialDelaySeconds, and check the probe path and port.
  8. Exit code 0: the container finished its work. Use a Job for one-off tasks, or make the process run in the foreground.
  9. Apply the fix and watch it recover: kubectl get pods -w.

Debug a container that crashes too fast

If the container dies before you can look inside, start a copy of the pod with a shell instead of the normal command:

kubectl debug <pod> -it --copy-to=debug-pod --container=<container> -- sh
# or override the command in a test pod
kubectl run test --rm -it --image=<your-image> --command -- sh

Inside the shell, run the start command yourself and you will see the exact error.

How to prevent it

  • Fail fast with clear log messages when a required setting is missing.
  • Use a startupProbe for slow apps so the liveness probe does not kill them while starting.
  • Set memory requests and limits from real usage (check kubectl top pod).
  • Test images locally with the same env vars before deploying.

Questions

Is CrashLoopBackOff an error in Kubernetes itself?

No. Kubernetes is restarting a container that keeps exiting. The fault is inside the container: the app, its command, its config or its resources.

How long does Kubernetes wait between restarts?

The delay doubles each time: 10s, 20s, 40s and so on, up to 5 minutes. It resets after the container runs fine for 10 minutes.

Why does `kubectl logs` show nothing?

You are seeing the new container, which has just started. Use kubectl logs <pod> --previous to read the logs of the run that crashed.