Skip to content

Init:CrashLoopBackOff

Init containers run one at a time before the app containers, and each must exit 0. Init:CrashLoopBackOff means one of them keeps failing. Init:Error is the same failure before the back-off starts. Init:0/2 means none of two init containers has completed yet.

  1. Which init container? kubectl get pod <pod> -o jsonpath='{range .status.initContainerStatuses[*]}{.name}: {.state}{"\n"}{end}'.
  2. Its logs, including the previous attempt: kubectl logs <pod> -c <init-container> --previous.
  3. Its exit code: in kubectl describe pod, under Init Containers, look at Last State.
Init container does Usual failure
Wait for a dependency (until nc -z db 5432) The dependency’s Service has no endpoints, or a NetworkPolicy blocks it
Run database migrations The migration fails, or two pods run it concurrently and one loses a lock
Fetch config or secrets Missing credentials or no network route to the secret store
Fix file permissions Pod Security forbids running as root, so chown fails

Fix the cause the logs show. Two design rules prevent most of these: don’t run migrations from an init container in a Deployment with many replicas (use a Job), and give “wait for dependency” loops a timeout and a clear log line so the failure is visible.