Free ops runbook · Kubernetes triage

CrashLoopBackOff: read the exit code before you restart the pod

The pod is in CrashLoopBackOff, the dashboard is red, and the fastest-looking action is to delete the pod. That also deletes the previous container's logs and the terminated state that explains why it died. The restart count and the exit code tell you which of several unrelated problems you have before you touch anything.

This page is free. It covers how to read the last termination, why 137 and 143 point at different owners, and how probes, limits and grace periods turn a slow start into a restart loop.

Scope: reviewed from the Kubernetes and container-runtime documentation, no live reproduction
Verified against the Kubernetes pod lifecycle, pod debugging and probe documentation, and the container runtime exit-status convention, on 2026-11-26. Command output below is the expected shape, not a capture from a live cluster; field names follow the current stable API.
Read the state

Four facts before any action

Restart count

Rising means the kubelet is restarting the container. A pod that is merely not ready has no restarts and a different fix.

Last termination

lastState.terminated carries the exit code, the reason and the signal. It survives restarts until the pod is deleted, which is why deleting is a last step.

Backoff is a symptom

The kubelet restarts with exponential backoff up to a cap. A long backoff means the container has already failed many times, not that it is waiting for a resource.

Who killed it

Exit 137 is a SIGKILL, usually the kernel OOM killer or a grace period that ran out. Exit 143 is a SIGTERM, usually a probe, a drain or a rollout.

Detect

Collect the evidence first

Command or viewWhat it tells you
kubectl get pods -o wideStatus, restarts, age and node. A single node with many failures is a node problem, not an app problem.
kubectl describe pod "$POD" | sed -n '/Last State/,/Ready/p'The last termination reason and exit code, plus the events for probe failures and OOM kills.
kubectl logs "$POD" --previous --tail=100The output of the container that died. Without --previous you read the new container, which may not have logged anything yet.
kubectl get pod "$POD" -o jsonpath='{range .status.containerStatuses[*]}{.name}{" "}{.restartCount}{" "}{.lastState.terminated.exitCode}{" "}{.lastState.terminated.reason}{"\n"}{end}'The structured version of the same facts, usable in a script or an alert payload.
kubectl get events --field-selector involvedObject.name="$POD" --sort-by=.lastTimestampThe order of events: image pull, probe failure, kill, restart. Order rules out causes that look plausible.
kubectl get pod "$POD" -o jsonpath='{.spec.containers[*].resources}'Requests and limits. A limit equal to the observed working set makes an OOM kill a matter of time.
kubectl top pod "$POD" --containersCurrent usage against the limit, where the metrics server is installed. Absence of metrics is not evidence of low usage.
Failure modes

Seven ways a container ends up in the loop

#Failure modeWhat you seeWhat to do
1Exit 137 read as "out of memory"The reason says Error, not OOMKilled, and the shutdown took exactly the grace period.Check terminationGracePeriodSeconds against the real shutdown time before raising the memory limit.
2A liveness probe that outruns startupExit 143 shortly after start, events show Liveness probe failed, and the app logs a normal boot in progress.Add a startup probe or raise the initial delay so liveness only begins after the app is serving.
3A memory limit below the working setExit 137 with reason OOMKilled, often after a period of stable traffic.Set the limit from observed p99 usage with headroom, and check runtime heap settings that ignore the container limit.
4Entrypoint or image driftExit 127 (command not found) or exit 1 before any application log line.Pin the image by digest and verify the command in the manifest rather than relying on the image default.
5Missing configuration at bootExit 1 with a validation error, or the pod never starts and reports CreateContainerConfigError.Distinguish a kubelet configuration failure from an application failure; the first never runs your process.
6A dependency that is still downEvery replica crashes at the same second after a deploy, with connection errors in the previous logs.Add bounded startup retries, and check the dependency before scaling or restarting the workload.
7Deleting the pod destroys the evidenceThe new pod has a new name, empty previous logs and no terminated state to inspect.Capture describe, --previous logs and events before any delete or rollout undo.
Design

Give the process room to fail loudly

DecisionQuestion to answer
ProbesDoes readiness describe traffic, liveness describe a hung process, and startup cover the slow boot?
ResourcesAre requests and limits based on measured usage, and does the runtime know the container limit?
GraceIs the grace period longer than the real shutdown path, and does the app handle SIGTERM?
EvidenceAre previous logs and events shipped somewhere before the pod is replaced?
AlertingDoes the alert fire on restart rate and on backoff duration, not only on the pod being not ready?
Verify

Four drills in a staging namespace

Deliberate OOM

Lower a limit below the working set and confirm the reason is OOMKilled, not a probe failure, and that the alert names the container.

Slow boot

Add a startup delay longer than the liveness initial delay and confirm the pod no longer loops once a startup probe is in place.

Bad config

Remove a required key and confirm the failure is a configuration error rather than a crash loop, so the alert routes to the right owner.

Graceful stop

Scale down under load and confirm the process exits on SIGTERM within the grace period, with no 137 in the terminated state.

FAQ

Questions from the on-call channel

Can we just restart the deployment?

It will usually produce a new set of pods with the same bug, and it discards the terminated state you needed. Read the previous logs and the exit code first; restart only after you have the cause or a fix.

Why does the backoff keep getting longer?

That is the kubelet's exponential restart delay with a cap. It is protecting the node from a crash loop, and it means the container has failed repeatedly. Fixing the cause resets the pattern on the next successful run.

Is exit 137 always OOMKilled?

No. 137 means the process received SIGKILL. The kernel OOM killer is one source; the kubelet sending SIGKILL after the grace period expires is another. The reason field and the timing tell them apart.

What if the pod is not ready but restarts are zero?

That is a readiness problem, not a crash loop. The container is running and the service is withholding traffic. Check the readiness probe, its threshold and the endpoint state before looking at exit codes.

Sources

Primary sources

Going deeper on the change window?

The paid runbooks cover the surrounding failures: deprecation windows that remove an API under you, cache rules that hide a deploy, and production defaults that only bite on a real domain.

This page is free, no checkout. Paid runbooks are $9.99 each and covered by the 7-day refund policy at /runbooks/refund.