CrashLoopBackOff is a waiting state that Kubernetes reports for a container which starts, exits and is restarted repeatedly. Instead of restarting it immediately, the kubelet applies an exponential back-off delay between restarts, starting at ten seconds and capped at five minutes. CrashLoopBackOff is not an error in itself but a symptom: the actual cause is whatever makes the container exit, such as an application error, missing configuration, an OOM kill or a failing liveness probe.
What is CrashLoopBackOff?
CrashLoopBackOff is one of the most common states you see in kubectl get pods. It appears when a container in a pod exits shortly after starting, Kubernetes restarts it according to the pod's restartPolicy (Always or OnFailure), and the container exits again. To avoid wasting resources and flooding logs, the kubelet does not restart the container in a tight loop. It waits between attempts, and while it waits, the container's state is Waiting with the reason CrashLoopBackOff.
NAME READY STATUS RESTARTS AGE
checkout-7d9f8b6c5d-x2kqp 0/1 CrashLoopBackOff 6 (2m ago) 9m
The important point: CrashLoopBackOff tells you that a container keeps failing, not why. Debugging always means finding the reason for the exit.
How the restart back-off works
The kubelet uses an exponential backoff for restarts: the delay starts at 10 seconds and doubles with each failure (10 s, 20 s, 40 s and so on) until it reaches a cap of five minutes. If a container then runs for ten minutes without crashing, the kubelet resets the back-off timer. This explains a typical pattern: the first restarts happen quickly, later ones only every few minutes, and the RESTARTS counter grows slowly but steadily. Events of the pod show the message Back-off restarting failed container.
Common causes
- Application errors at startup: an unhandled exception, a failed database migration or a dependency that is not reachable makes the process exit with a non-zero code. The stack trace in the container logs usually points to the cause.
- Missing or wrong configuration: an absent environment variable, a ConfigMap or Secret with a wrong key, or a mounted file at an unexpected path.
- Out of memory: the container exceeds its memory limit and is terminated with
OOMKilled. This OOM kill often follows limits that are set below the real peak. - Failing liveness probe: if the liveness probe fails, the kubelet kills and restarts the container. A probe without enough initial delay, or without a startup probe for slow starting applications, can produce a crash loop in an otherwise healthy service.
- Wrong command or image: a typo in
commandorargs, a missing binary or an image built for a different CPU architecture (exec format error). - Process finishes on purpose: a container whose main process simply completes, for example a script meant to run as a Job, is restarted forever under
restartPolicy: Always.
Reading exit codes
The last termination state of the container contains an exit code and often a reason. Typical values:
| Exit code | Meaning |
|---|---|
| 1 | Generic application error, check the logs |
| 126 / 127 | Command not executable or not found |
| 137 | Killed with SIGKILL, often OOMKilled or a liveness probe failure |
| 139 | Segmentation fault (SIGSEGV) |
| 143 | Terminated with SIGTERM, for example during a graceful shutdown |
How to debug CrashLoopBackOff
A structured approach saves time:
- Run
kubectl describe pod <pod>and look atLast State, the exit code, the reason and the events at the bottom. - Read the logs of the previous, crashed instance, because the current one may not have written anything yet:
kubectl logs checkout-7d9f8b6c5d-x2kqp --previous \
--container checkout
- Check events across the namespace with
kubectl get events --sort-by=.lastTimestampfor probe failures, failed mounts or scheduling problems. - Compare with the last working version: did a deployment change the image, environment variables, resources or probes?
- If the container exits too quickly to inspect, override the command temporarily or use
kubectl debugwith an ephemeral container.
Because the logs of crashed containers are lost when the pod is deleted, central log collection is essential. Our Kubernetes observability checklist shows which signals you should collect.
Alerting on crash loops
kube-state-metrics exposes kube_pod_container_status_waiting_reason{reason="CrashLoopBackOff"} and the restart counter kube_pod_container_status_restarts_total. Useful alert rules check whether a container has been in CrashLoopBackOff for several minutes or whether its restart count increases within a time window. Alerts should name the workload, namespace and last exit reason, so the person on call can see immediately whether an OOM kill, a probe or an application error is involved.
How Obseria helps
Obseria's Kubernetes monitoring collects pod states, restart counts, exit reasons and events through the OpenTelemetry Collector and kube-state-metrics, and keeps the logs of crashed containers centrally, so they remain available after the pod is gone. Restarts appear next to deployments, resource usage and traces of the affected service. Alerts can trigger on crash loops or rising restart counts, error tracking groups the exceptions behind them, and Obseria Intelligence helps connect a crash loop with the change that introduced it.