CrashLoopBackOff is the error you hit the moment you deploy something real to Kubernetes. The fix crashloopbackoff kubernetes workflow is the same every time: the kubelet starts your container, the container exits with an error, and Kubernetes waits a bit longer before trying again. That growing wait is the “backoff” in the name. It is not a Kubernetes bug. Your container is failing, and the checklist below walks you through finding out exactly why.
If you are still getting comfortable with pods and deployments, read this practical guide to Kubernetes for developers first so the commands below make sense. Then come back and work through these steps in order.
What CrashLoopBackOff Actually Means
When a pod shows CrashLoopBackOff, the loop looks like this: container starts, container exits (any non-zero exit code), kubelet waits 10 seconds, tries again, waits 20 seconds, 40 seconds, and so on up to five minutes between restarts. The pod never reaches a healthy state, so it is never marked Ready.
Check the current state with:
kubectl get pods -n your-namespace
The RESTARTS column climbing while the pod stays in CrashLoopBackOff confirms the loop. Your job is to find out why the process inside the container keeps dying. Start with the logs.
Step 1: Read the Container Logs
Logs are where most CrashLoopBackOff investigations end. Use the --previous flag to see the logs of the last crashed instance instead of the (empty) current one:
kubectl logs my-app-7d9f8c6b4-x2kqj -n your-namespace --previous
For multi-container pods, add -c container-name. Limit output with --tail=200 when the log is long. What you are looking for: a stack trace, a panic message, “connection refused” to a database, “file not found”, or a missing environment variable error. Copy the exact error line. That line usually names the fix.
If your app logs to stdout but they vanish before you can read them, you need a persistent pipeline. Compare options in this guide to log management tools for Kubernetes (Loki vs Elasticsearch vs Datadog) so crash logs survive the pod restart.
Step 2: Check Pod Events with kubectl describe
When logs are empty, pod events tell the story. This kubernetes pod crash troubleshooting step shows the exit code, the reason, and who killed the container:
kubectl describe pod my-app-7d9f8c6b4-x2kqj -n your-namespace
Scroll to the Events section. Look for Reason: OOMKilled (exit code 137), Liveness probe failed, Back-off restarting failed container, or Failed to pull image. Also list recent cluster events sorted by time for a wider view:
kubectl get events --sort-by=.metadata.creationTimestamp -n your-namespace
Events with no obvious cause plus empty logs usually point at a crash that happens before the app even writes a line, which brings us to the most common root cause.
Step 3: Fix CrashLoopBackOff Kubernetes App Startup Failures
Most CrashLoopBackOff cases come down to one thing: the application itself crashes within seconds of starting. Typical triggers are a missing environment variable, a wrong command or args in the manifest, an unhandled exception, or a database the app cannot reach at boot.
Test the container outside Kubernetes first. If it crashes the same way locally, the cluster is not the problem:
docker run --rm -e DB_HOST=db.internal my-registry/my-app:1.4.2
Then compare against your deployment manifest. Common slip-ups: the command/args field overrides the image entrypoint incorrectly, env references a ConfigMap key that does not exist (the pod may also hang in CreateContainerConfigError), or the app listens on port 3000 while the manifest expects 8080. Run the container locally with the exact env and args from your YAML and iterate until it stays up. Only then redeploy.
Step 4: Check Liveness and Readiness Probes
A healthy app can still be driven into a restart loop by an over-eager liveness probe. If the probe fires before the app finishes starting, the kubelet kills a container that would have become healthy seconds later. The events section shows this as repeated Liveness probe failed warnings.
Give slow-starting apps a proper grace period. A startupProbe that disables liveness checks until the app is actually up is cleaner than a long initialDelaySeconds:
livenessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 10
startupProbe:
httpGet:
path: /healthz
port: 8080
failureThreshold: 30
periodSeconds: 5
This gives the app up to 150 seconds to start. Verify the probe path actually exists too: a probe hitting /health when the app serves /healthz fails forever, and the pod restarts forever.
Step 5: OOMKilled — Your Memory Limit Is Too Low
Exit code 137 in the events means the kernel killed your container for using more memory than its limit. The app code is fine; the limit is wrong. Check real usage:
kubectl top pod my-app-7d9f8c6b4-x2kqj -n your-namespace
Compare against the resources.limits.memory in your manifest. Java and Node apps are frequent offenders because the runtime heap default ignores the container limit, so the process happily allocates past it. Set an explicit heap cap (for example -Xmx512m or --max-old-space-size=512) that sits comfortably under the limit, then raise the limit itself if the app genuinely needs more. On a managed Kubernetes cluster (EKS, GKE, or AKS), raising the limit may mean bumping the node pool size too, so size it once with headroom instead of nudging it weekly.
Step 6: Verify the Image, Tag, and Pull Policy
Crash loops after a “successful” deploy often trace back to the wrong image actually running. Check the digest the node pulled:
kubectl get pod my-app-7d9f8c6b4-x2kqj -n your-namespace
-o jsonpath='{.status.containerStatuses[0].imageID}'
The classic trap is the :latest tag with imagePullPolicy: IfNotPresent: you push a fixed image, but every node keeps running the cached broken one. Pin releases to immutable tags or digests, and use imagePullPolicy: Always for anything you retag. Bloated images make this worse because a corrupted layer cache is harder to spot; building lean images with multi-stage Dockerfiles keeps the image you test identical to the image you ship.
CrashLoopBackOff Troubleshooting Checklist
Use this crashloopbackoff troubleshooting checklist as your runbook and work it top to bottom:
- Logs first:
kubectl logs <pod> --previous --tail=200, then with-cfor multi-container pods. - Events second:
kubectl describe podand sortedkubectl get events; note the exit code and reason. - App crash (exit 1): reproduce with
docker runusing the exact env and args; fix the code or config, not the cluster. - Probe failures: add a
startupProbe, confirm the health endpoint path matches the app. - OOMKilled (exit 137):
kubectl top pod, cap runtime heap, raise the memory limit. - Wrong image: compare
imageIDdigest to what you pushed; pin immutable tags, avoid:latestin production. - Still stuck: remove the probes and limits temporarily in a staging namespace to isolate which layer causes the crash, then re-add them one at a time.
CrashLoopBackOff rewards a boring, systematic approach. Read the logs, check the events, reproduce the crash locally, and fix the layer that fails. Nine times out of ten the cluster is doing exactly what it should; it is just reporting your app’s mistake on a delay.