Back to articles

CrashLoopBackOff: a taxonomy of causes and how to identify them

CrashLoopBackOff is a state, not a cause: it says a container keeps stopping, never why. A four-step method using the last state, the exit code and the previous container's logs sorts a crash loop into one of seven categories, with kubectl debug for images that have no shell.

CrashLoopBackOff tells you almost nothing about what went wrong. It says a container started, stopped, and that the kubelet is now waiting before it tries again. The cause is somewhere else: in the exit code, in the previous container's logs, or in an event a few lines further down.

Who this is for: engineers looking at a restarting pod during an incident, or writing up afterwards why it took an hour to find a typo in an environment variable.

What you walk away with: a four-step method that narrows a crash loop to one category, a table of exit codes and what each proves, and the kubectl debug commands for images that have no shell.

Everything here is drawn from the Kubernetes v1.37 documentation and source, and from the containerd 2.4 and runc 1.5 source for runtime-specific behaviour. On 17 November 2026 the commands and failure cases were run on one cluster (GKE 1.36.4, containerd 2.2.7). Not run: the kubelet back-off settings, CreateContainerError, ReadWriteOnce volumes and kube-state-metrics.

It's a state, not a cause

CrashLoopBackOff is a display value in the STATUS column of kubectl get pods, not a pod phase. The phase stays Running. Underneath, the container is Waiting with the reason CrashLoopBackOff.

The sequence the documentation describes:

  1. The first crash is followed by an immediate restart.
  2. Repeated crashes get an exponential back-off delay: 10s, 20s, 40s and so on, capped at 300 seconds.
  3. Once a container has run for 10 minutes, the kubelet resets the back-off for that container.

Your fix may already be working. At a five-minute delay, a corrected ConfigMap changes nothing visible until the delay expires. The back-off is tracked per pod, so deleting the pod and letting its controller create a new one starts clean.

A slow crash doesn't look like a crash loop. A container that runs for eleven minutes before dying resets its back-off every time. It shows Running with a climbing restart count, and never CrashLoopBackOff. Watch the RESTARTS column as well as the status.

Has the back-off changed?

Not by default in v1.37. KubeletCrashLoopBackOffMax (beta, on by default since v1.35) lets you set crashLoopBackOff.maxContainerRestartPeriod in the kubelet configuration, per node, between 1s and 300s; unset, the maximum stays 300s. ReduceDefaultCrashLoopBackOffDecay (alpha since v1.33, off by default) starts at 1s and caps at 60s.

The method

Step 1: read the last state

kubectl describe pod <pod> -n <namespace>

In the container's block, read Last State, not State:

    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 23 Sep 2026 10:14:02 +0200
      Finished:     Wed, 23 Sep 2026 10:14:03 +0200
    Ready:          False
    Restart Count:  6

Step 2: read the previous container's logs

kubectl logs <pod> -n <namespace> -c <container> --previous

--previous returns the instance under Last State. While the container waits in back-off, plain kubectl logs returns that same instance, because there is no newer one. Once the next attempt starts, plain kubectl logs switches to it and only --previous reaches the one that died. Right after a crash, while STATUS still reads Error, it's the other way round: plain kubectl logs has the instance that just died, and --previous answered unable to retrieve container logs for containerd://… in the test. --all-containers replaces -c for every container in the pod.

Empty output means the process died before writing anything, or never ran.

Step 3: read the events

At the bottom of kubectl describe pod. The back-off itself appears as:

Warning  BackOff  kubelet  spec.containers{app}: Back-off restarting failed container app in pod web-6c9f7d-x2x1p_shop(…)

Look around it for Unhealthy (a probe failed), Killing (the kubelet stopped the container, and says why) and Failed (the container couldn't be created or started). Events expire after an hour by default, so collect them early: see How to read Kubernetes events.

Step 4: sort it into a category

Reason, exit code, lifetime and log tail should leave one or two candidates below.

Exit codes: what they prove

Kubernetes reports the code and doesn't interpret it. A process killed by a signal has no exit code of its own: shells report 128 plus the signal number, and containerd does the same.

Code Meaning comes from What it tells you
0 The process It finished without an error. Under restartPolicy: Always that's still a crash loop.
1 The process A general application error. Read the logs.
2 The process By convention a usage error (Bash: misuse of a builtin). A Go program that panics also exits with 2.
126 The shell The command was found but isn't executable.
127 The shell The command wasn't found.
128 containerd With the reason StartError: the runtime couldn't start the process at all.
134 128 + 6 SIGABRT. The process aborted itself. As PID 1, an aborting Node.js showed 139 instead.
137 128 + 9 SIGKILL. OOMKilled is one sender. The kubelet, after a grace period ran out, is another.
139 128 + 11 SIGSEGV, a segmentation fault.
143 128 + 15 SIGTERM. Something asked the process to stop and it did.
255 The process or the runtime An application exit of -1. Also runc when the final exec of your binary fails, and containerd when it can't determine the exit status.

126 and 127 are shell conventions. Bash defines them, and you see them when a shell failed to run your command: an entrypoint script calling a binary that isn't in the image, for example. When the container's own entrypoint is missing or not executable, no shell is involved. runc checks for the executable before starting the container, and containerd records StartError with exit code 128. The message, in describe and in a Failed event, names the file. On containerd 2.2.7 it reads:

failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "/app/server": stat /app/server: no such file or directory

For a bare command name the tail reads exec: "server": executable file not found in $PATH.

137 isn't a synonym for out of memory. It means SIGKILL. With the reason OOMKilled, go to OOMKilled (exit code 137): leak or limit?. With Error, something else sent the signal: check first for a container that didn't stop within its grace period after a failed liveness probe.

The taxonomy

1. The application fails on start-up

Evidence: exit code 1 (or another small number), reason Error, a lifetime of seconds, and a stack trace or error message in logs --previous.

A configuration value the application rejects, a missing environment variable, a failed schema migration. If the log doesn't name the problem, run the application with a changed command (see below) and watch it fail.

2. A dependency isn't there

Evidence: as category 1, but the log mentions a refused connection, a name that doesn't resolve, or a timeout.

Check whether the dependency is down or merely unreachable from this pod: a NetworkPolicy, a wrong Service name, or cluster DNS (CoreDNS debugging).

3. The command or entrypoint is wrong

Evidence: reason StartError with exit code 128 (STATUS may read RunContainerError), or exit codes 126 and 127, and no application logs. Or exit code 0 with reason Completed.

A single-architecture image built for another CPU architecture than the node has different evidence. The kernel refuses the binary only after the container has started, so the reason is Error, the exit code is 255 (seen with runc 1.4), and the log holds one line of the form exec /app/server: exec format error. A multi-architecture image with no entry for the node fails at the pull instead: see ImagePullBackOff explained.

4. The container is killed for memory

Evidence: reason OOMKilled, exit code 137.

The diagnosis is in OOMKilled (exit code 137): leak or limit?.

5. A liveness probe kills a slow starter

Evidence: Unhealthy events for the liveness probe, then a Killing event. A lifetime of roughly initialDelaySeconds + periodSeconds × failureThreshold.

Warning  Unhealthy  kubelet  spec.containers{app}: Liveness probe failed: …
Normal   Killing    kubelet  spec.containers{app}: Container app failed liveness probe, will be restarted

The logs show a normal start-up that ends abruptly. The exit code depends on what the application does with SIGTERM: 143, a code of its own (0 shows as Completed), or 137 if it's still running when the grace period ends.

A startupProbe is the documented answer: liveness checks don't begin until it succeeds. Health probes done right covers the design.

6. Permissions, read-only filesystems and securityContext

Evidence: exit code 1 or 126, and a log line containing permission denied, operation not permitted or read-only file system, in any capitalisation.

With runAsNonRoot: true and an image that runs as root, the kubelet refuses to create the container: container has runAsNonRoot and image will run as root. That's a CreateContainerConfigError, covered below, not a crash loop.

7. An init container fails

Evidence: the status reads Init:CrashLoopBackOff or Init:Error, and the app containers never start.

The same method applies, with -c <init-container>. The documentation has a table of Init: statuses.

States that look similar but aren't

These appear in the same STATUS column, but the container never ran: there is no exit code and no log.

Status Meaning Where to look
CreateContainerConfigError The kubelet couldn't build the container's configuration. For a ConfigMap or Secret referenced from env or envFrom: configmap "app-config" not found, secret "db" not found or couldn't find key DB_URL in ConfigMap shop/app-config. The Failed event.
CreateContainerError The runtime rejected the container. The Failed event.
ImagePullBackOff, ErrImagePull The image couldn't be pulled. ImagePullBackOff explained
ContainerCreating for minutes Check for a volume that can't mount, including a ConfigMap or Secret volume whose object doesn't exist. FailedMount events.

A missing ConfigMap causes CrashLoopBackOff only when the reference is marked optional: true: the container starts without it and the application exits.

When logs aren't enough: kubectl debug

You can't kubectl exec into a container that's in back-off, and distroless images have no shell anyway. kubectl debug gives two documented ways in.

Add an ephemeral container to the running pod. It shares the pod's network and, with --target, the process namespace of one container:

kubectl debug -it <pod> -n <namespace> --image=busybox:1.36 --target=<container>

The runtime has to support --target. An ephemeral container can't be removed once added.

Copy the pod and change its command. For a container that dies immediately:

kubectl debug <pod> -n <namespace> -it --copy-to=<pod>-debug --container=<container> -- sh

The copy runs sh in place of the entrypoint, with the same image, environment and volumes, so you can start the real command by hand and watch it fail.

If the image has no shell, add a debugging container to the copy:

kubectl debug <pod> -n <namespace> -it --image=busybox:1.36 --share-processes --copy-to=<pod>-debug

The crashing container's filesystem is then reachable through /proc/<pid>/root, as long as a process is alive in it.

Preventing the next one

Start with Last State.