Home / Troubleshoot / Kubernetes CrashLoopBackOff
Kubernetes · CrashLoopBackOff

Kubernetes CrashLoopBackOff: How to Diagnose and Fix It

CrashLoopBackOff means a container starts, exits, and Kubernetes keeps restarting it with growing back-off. It's a symptom — the real cause is in the events and the previous container's logs.

Step 1 — Read the events and last state

kubectl describe pod <pod>

Scroll to Last State and the Events at the bottom. Note the Reason and Exit Code — they point straight at the cause (for example Reason: OOMKilled, Exit Code: 137 means out of memory).

Step 2 — Read the crashed container's logs

kubectl logs <pod> --previous

The --previous flag is essential — it shows the logs of the container instance that crashed, not the fresh one. This is where an application stack trace or "config not found" error appears.

Step 3 — Match the symptom to the cause

  • Application error on startup — a stack trace in the logs; fix the code or the input it's choking on.
  • Missing config / secret / env var — the app exits because a required value isn't mounted; check the ConfigMap/Secret and volume mounts.
  • OOMKilled (exit 137) — the container exceeded its memory limit; raise resources.limits.memory or fix the leak.
  • Failing liveness probe — the app is fine but the probe path/port/timing is wrong, so the kubelet keeps killing it; fix the probe.
  • Bad command/entrypoint or missing dependency — exit code 127/126; correct the command or image.

Step 4 — Fix and confirm

Apply the fix, then watch it recover:

kubectl get pods -w

The pod should move to Running and stay there, with the restart count holding steady.

How Tech Matrix solves this in ~60 seconds

CrashLoopBackOff has five common causes and the slow part is correlating the exit code, events, probe config and logs. Tech Matrix reads the pod's describe output, the previous-container logs and the manifest, and tells you which of the five it is — and the exact fix — instead of you grepping across kubectl output.

Frequently asked questions

What does CrashLoopBackOff mean in Kubernetes?

The container starts, exits, and Kubernetes restarts it repeatedly with an increasing back-off delay. The crash itself has a separate cause shown in the events and previous logs.

How do I find why a pod is crashing?

Run 'kubectl describe pod ' for the Last State reason and exit code, then 'kubectl logs --previous' to read the crashed container's logs.

What is exit code 137 in Kubernetes?

Exit 137 is OOMKilled — the container exceeded its memory limit. Raise resources.limits.memory or fix the memory leak.