Init:CrashLoopBackOff ☸️ Kubernetes

Pod status Init:CrashLoopBackOff / Init:Error

An init container keeps failing, so the pod’s main containers never start.

Seen on: Kubernetes

Meaning

Init containers run in order before the app and must all exit 0. Typical ones wait for a database, run migrations or copy files; if they fail, the pod shows Init:Error then Init:CrashLoopBackOff. Their logs are separate — use -c with the init container name.

Common causes

  • Migration or setup script fails
  • Dependency (DB, service) unreachable from the init container
  • Wrong command/image in the init container
  • Missing secret/env for the init step

⚡ Quick fix

  1. kubectl logs pod -c <init-container>
  2. Fix the dependency or script
  3. Run the init command manually in a debug pod

Detailed fix by platform

Kubernetes

  1. bash
    kubectl get pod api-0 -o jsonpath='{.spec.initContainers[*].name}'
    kubectl logs api-0 -c migrate --previous

How to diagnose

  1. Which init — Name and exit code (describe pod)
  2. Logs — Output of that init container
  3. Dependency — Reachable from the namespace?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.