CrashLoopBackOff
CrashLoopBackOff is a Kubernetes pod status meaning a container keeps crashing after starting, and the kubelet is waiting longer between each restart. The delay grows from 10 seconds up to a 5 minute cap, and the status signals a problem inside the container, not a transient network blip.
What it means
The container starts, exits, and Kubernetes restarts it per restartPolicy. To avoid hammering a broken workload, restarts back off exponentially: 10s, 20s, 40s, 80s, 160s, then 300s. The pod is not stuck, it is retrying on a growing timer.
Diagnose in four steps
# 1. Logs from the previous (crashed) containerkubectl logs api-server-7d9f8b-xkp2q -n production --previous # 2. Exit code and reason of the last terminationkubectl get pod api-server-7d9f8b-xkp2q -n production \ -o jsonpath='{.status.containerStatuses[0].lastState.terminated}' # 3. Events and probe failureskubectl describe pod api-server-7d9f8b-xkp2q -n production # 4. Watch the restart countkubectl get pod api-server-7d9f8b-xkp2q -n production -wraise memory limit"] E -->|"1"| A["App error
read logs"] E -->|"126 or 127"| X["Bad command
fix entrypoint"] E -->|"0 with probe fail"| L["Liveness probe
too aggressive"] classDef start fill:#475569,color:#ffffff classDef decide fill:#FFEDD5,color:#1E293B classDef fix fill:#D1FAE5,color:#1E293B class S start class E decide class M,A,X,L fix
Exit codes
| Code | Meaning | Typical fix |
|---|---|---|
| 1 | Application error on startup | Read logs for the stack trace |
| 126 | Command found but not executable | Check file permissions |
| 127 | Command not found | Verify entrypoint path in the image |
| 137 | SIGKILL, often OOMKilled | Check reason, raise memory limit |
| 139 | Segmentation fault | Debug the application |
Common causes
- A missing environment variable or Secret key.
- A slow-starting app killed by a liveness probe. Add a startup probe or raise
initialDelaySeconds. - Memory limit too low.
- A wrong image entrypoint or missing binary.
- A dependency such as the database being unreachable at startup.
startupProbe: httpGet: path: /healthz port: 8080 failureThreshold: 30 periodSeconds: 10TipAlways use
--previous. The current container has often just restarted and has no useful output yet.
RememberCrashLoopBackOff is a symptom. The exit code and the previous logs tell you which direction to investigate.
Common MistakeRunning
kubectl logswithout--previous, seeing nothing, and concluding there are no logs.
Frequently Asked Questions
Why does Kubernetes delay restarts instead of retrying immediately?
Immediate retries would waste node resources and could worsen the cause, such as overloading a dependency. The growing delay gives dependencies time to recover.
What is the fastest way to diagnose it?
Read kubectl logs --previous and the last exit code. Most cases are a missing config value, a failed dependency, or an OOMKill, and the exit code separates them quickly.
How is CrashLoopBackOff different from ImagePullBackOff?
In CrashLoopBackOff the image was pulled and the container ran, then crashed. In ImagePullBackOff the container never started because the image could not be pulled.