← all cheat sheets
FUNDAMENTALS · MECHANISM WALKTHROUGH

Pod Stuck in CrashLoopBackOff
What Really Happens, and How to Diagnose It

the exact restart-and-backoff mechanism behind the most common status message in Kubernetes, and where to actually look.
CONTAINER STARTS PROCESS EXITS KUBELET RESTARTS BACKOFF DOUBLES STATUS = CrashLoopBackOff EVENTS LOGGED DIAGNOSE
01 The Full Sequence — Worked Example
1

Container Starts Normally

kubelet asks the container runtime to start the container's entrypoint process — from the runtime's point of view, this is a completely ordinary start, identical to any healthy Pod.

Start
2

Process Exits (Non-Zero, Usually Immediately)

The entrypoint process terminates — a missing environment variable causes a startup exception, a config file is absent, a dependent service (database) isn't reachable yet. The container exits with a non-zero code.

Exit
3

kubelet Sees the Exit, Applies restartPolicy

kubelet notices the container exited and checks the Pod's restartPolicy (default: Always). Since it's Always, kubelet restarts the container immediately the first time.

Restart Policy
4

Same Failure, Same Exit — Again

Because nothing about the underlying cause (bad config, unreachable dependency) has changed, the restarted container fails identically within moments. This is a Pod's own restart loop, entirely local to the node — no scheduler or API server round-trip is needed for a restart.

Repeat
5

Checkpoint — Exponential Backoff Kicks In

After the first couple of rapid restarts, kubelet doesn't keep restarting instantly — it applies exponential backoff: 10s → 20s → 40s → 80s..., capped at 5 minutes. This is precisely the "CrashLoopBackOff" state: Kubernetes has decided the container is unhealthy and is deliberately slowing down the restart rate.

Checkpoint
6

Pod Status Reflects the Loop

kubectl get pods shows CrashLoopBackOff as the status, and RESTARTS climbs with every cycle. The Pod is never marked Failed outright — it stays in this loop indefinitely unless the underlying cause is fixed or the Pod is deleted.

Status
7

Events Are Recorded, Not Just the Status

Each restart, image pull, and backoff decision generates an Event object visible via kubectl describe pod — this Events section, not the top-line status, is where the actual reason (OOMKilled, failed liveness probe, non-zero exit code) usually shows up.

Events
8

Diagnose: Logs from the Crashed Instance

kubectl logs <pod> --previous retrieves stdout/stderr from the last crashed container instance — the current instance may not have produced any output yet, so this flag is essential, not optional.

Diagnose
9

Diagnose: Describe for Exit Code & Reason

kubectl describe pod shows the Last State block with the exact exit code and reason (e.g. Error, OOMKilled). An exit code of 137 specifically points to an OOM kill or SIGKILL, not an application-level error.

Describe
10

Resolution Requires Fixing the Root Cause

Deleting/recreating the Pod, or waiting, does nothing on its own — the backoff timer resets with a new Pod, but the same underlying issue (bad config, missing secret, insufficient memory limit) causes the same crash again. Only fixing the actual cause breaks the loop.

Resolve
02 How to Explain This in an Interview
03 Follow-Up / Gotcha Questions
Q Does the scheduler get involved in restarting a crashed container?
A No — a container restart on the same node is handled entirely by the local kubelet. The scheduler only gets involved if the whole Pod is deleted and a new one needs to be scheduled, or in the ReplicaSet replacing a genuinely failed Pod.
Q What's the difference between a liveness probe failure and CrashLoopBackOff from a bad exit code?
A Both lead to the same restart-and-backoff mechanism, but a liveness probe failure means the process is technically still running yet judged unhealthy, while a bad exit code means the process itself terminated. describe pod distinguishes them in the Last State reason.
Q Does backoff time reset if I delete and recreate the Pod?
A Yes — backoff state is tracked per Pod instance by kubelet, so a fresh Pod starts the cycle over from the shortest interval, which is exactly why deleting a crashlooping Pod without fixing the cause just buys a brief false sense of progress.
Q Can a container be in CrashLoopBackOff but never actually crash?
A Yes, indirectly — a repeatedly failing startupProbe or livenessProbe can cause kubelet to kill and restart an otherwise-fine process, producing the identical status and backoff behavior as a genuine application crash.
Q Why might logs --previous return nothing?
A If this is the very first start (no prior crashed instance yet) or the container never produced output before dying (e.g. failed before the app's logger initialized), there's nothing to retrieve — check describe pod's Events instead.
Q Does CrashLoopBackOff ever resolve itself without any change?
A Occasionally — if the root cause was transient (e.g. a dependency service was briefly unavailable during startup), a later automatic restart can succeed once that dependency becomes reachable, since the backoff loop keeps retrying indefinitely.
04 Quick-Fire Glossary
TermMeaning
restartPolicyPod-level setting (Always, OnFailure, Never) controlling container restart behavior
Exponential BackoffIncreasing delay between restart attempts, capped at 5 minutes, to avoid a tight crash loop
--previouskubectl logs flag retrieving output from the last crashed container instance
Last Statedescribe pod section showing the previous container's termination reason & exit code
Exit Code 137128 + SIGKILL(9) — typically an OOM kill or forced termination
Exit Code 1Generic application-level error, uncaught exception
OOMKilledContainer exceeded its memory limit and was killed by the kernel cgroup controller
Liveness ProbeHealth check that, if it keeps failing, causes kubelet to restart the container
Startup ProbeGate that delays liveness/readiness checks until an app finishes a slow startup
EventsPer-object log of state changes/reasons, viewed via kubectl describe or get events