Use it when a pod is in CrashLoopBackOff.
CrashLoopBackOff
CrashLoopBackOff means a container keeps exiting and Kubernetes waits longer before each restart.
1. kubectl logs <pod> --previous.
2. Exit code/reason: kubectl describe pod (Last State).
3. OOMKilled → raise limit or fix memory use.
4. Missing config/secret/volume → events.
5. Liveness probe too strict?
container starts → exits → backoff → restart
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
kubectl describe pod <pod>Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Read previous logs and the exit reason. Check command and args, required environment variables and mounted files. Run the image locally with the same configuration to reproduce.
Step 2 Finding the cause Verify boundary
kubectl describe pod <pod> # Last State: Terminated, Reason, Exit Code
kubectl logs <pod> --previous
kubectl get events --sort-by=.lastTimestamp
| Exit code | Usual cause |
|---|---|
| 1 / app-specific | Application error, missing config/secret |
| 137 | OOMKilled (memory limit) or SIGKILL |
| 139 | Segfault |
| 143 | SIGTERM (e.g. failed liveness probe) |
Also check liveness probes that fail too early and commands that exit immediately.
Step 3 Common failures Narrow the fault
A wrong command or missing configuration file exits immediately. A liveness probe that fails too early looks like a crash loop. Missing dependencies such as an unreachable database often cause quick exits.
The cause is in the previous container's logs and exit code: app error (1), misconfiguration, missing config/secret, OOMKilled (137), failing liveness probe.
kubectl 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
ReferenceWhat it is1 section · depth on demand
How it works
The kubelet restarts the container according to restartPolicy and applies exponential backoff. The container may run for only a moment, so live logs are often empty; --previous shows the terminated instance.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
The backoff schedule
After each exit the kubelet waits longer before the next start: 10 s, 20 s, 40 s … capped at 5 minutes, and the delay resets after the container runs successfully for 10 minutes. A Pod in CrashLoopBackOff is therefore usually waiting, not failing right now.
A five-step diagnosis
kubectl get pod api-7f… -o wide # RESTARTS count and node
kubectl describe pod api-7f… | sed -n '/Last State/,/Ready/p'
# Last State: Terminated Reason: Error Exit Code: 1 Finished: …
kubectl logs api-7f… --previous --tail=50 # output of the crashed instance
kubectl get events --field-selector involvedObject.name=api-7f… --sort-by=.lastTimestamp
kubectl get pod api-7f… -o yaml | grep -A5 -E 'command:|args:|envFrom:|volumeMounts:'
Mapping the evidence to a cause
| Evidence | Likely cause | Next step |
|---|---|---|
Exit 1 + stack trace in --previous | Application error at start-up | Fix config or code |
| Exit 1, log says missing file/variable | ConfigMap/Secret key or mount path wrong | Compare manifest with what the app expects |
Reason: OOMKilled, exit 137 | Memory limit too low or leak | Raise limit or profile memory |
Exit 137/143 with Unhealthy liveness events | Liveness probe kills a slow start | Add a startup probe |
| Exit 0 repeatedly | Process finishes — wrong command for a long-running Pod | Use a Job, or fix the entrypoint |
Empty --previous logs, exit 127/126 | Command not found / not executable | Check image entrypoint and architecture |
Reproduce without the crash loop
kubectl debug api-7f… -it --copy-to=api-debug --container=api -- sh starts a copy with a shell instead of the entrypoint, so you can run the start command by hand and watch it fail.
Common mistakes
- Restarting the pod without reading
kubectl logs --previous.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.