Skip to content

Runbook: Fix pod stuck in CrashLoopBackOff

Find out why a container keeps restarting and get the pod Running again.

RunbookCreated Updated

Also:CrashLoopBackOff · Back-off restarting failed container · crashloop · k8s · pod restarting · OOMKilled · exit code 137 · exit code 1

  • kubectl get pods shows CrashLoopBackOff and the RESTARTS count keeps climbing.
  • Events show Back-off restarting failed container.
  • Alert: KubePodCrashLooping.

If the deployment still has healthy replicas, users may not notice yet. If all replicas crash, the service is down: go straight to Fix → roll back below.

  1. Read the logs of the container that died, not the new one that is starting up: Kubernetes: Show logs of the previous crashed container

    Terminal window
    kubectl logs <pod> -n <namespace> --previous
  2. Read the last termination reason and exit code: Kubernetes: Describe a pod to see events

    Look at Last State: Terminated, Reason, Exit Code:

    Exit code / reason Usually means
    OOMKilled, 137 Hit the memory limit
    1 App error at startup (config, missing env var, failed migration)
    126 / 127 Bad entrypoint or command not found in the image
    143 SIGTERM: often a liveness probe killing a slow-starting app
  3. Check recent events in the namespace for probe failures and missing Secrets/ConfigMaps: Kubernetes: List recent events sorted by time

  4. Did something just change? kubectl rollout history deployment/<deployment> -n <namespace>.

  1. Bad release (started right after a deploy): roll back first, debug later. Kubernetes: Roll back a deployment
  2. OOMKilled: compare usage with the limit (Kubernetes: Show pod CPU and memory usage), raise resources.limits.memory or fix the leak.
  3. Missing config / secret: the logs name the variable. Fix the ConfigMap/Secret, then restart the deployment.
  4. Liveness probe too aggressive: add a startupProbe or raise initialDelaySeconds / failureThreshold.
  • Set memory requests = limits for critical workloads; alert at 80% of the limit.
  • Use --atomic on Helm deploys so failed releases roll back automatically.
  • Add a startupProbe for apps that take more than ~10s to boot.

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…