Init container is crashing repeatedly
Production Risk
Application container never starts; pod contributes zero capacity.
Init:CrashLoopBackOff means an init container is failing repeatedly and Kubernetes is backing off restarts with exponential delay. Because init containers must complete successfully before app containers start, the main application never launches. This completely blocks the pod from becoming Ready.
- 1Init container script fails due to missing dependency or service not yet available
- 2Database or external service that init container waits for is down
- 3Wrong credentials or permissions used by the init container
- 4Bug in the init container logic causing non-zero exit
Pod stuck in Init:CrashLoopBackOff; main application container has not started.
kubectl get pods # NAME READY STATUS RESTARTS AGE # mypod 0/1 Init:CrashLoopBackOff 5 10m kubectl logs mypod -c init-container-name --previous
expected output
NAME READY STATUS RESTARTS AGE mypod 0/1 Init:CrashLoopBackOff 5 10m
Fix 1
Read init container logs
WHEN Always first step
# List init containers kubectl describe pod mypod | grep -A 5 "Init Containers:" # Read logs from the specific init container kubectl logs mypod -c my-init-container --previous
Why this works
Init container logs reveal why the init step is failing.
Fix 2
Verify dependency availability
WHEN Init container waits for a database or service
# Test connectivity from inside the cluster kubectl run nettest --image=busybox --restart=Never -it --rm -- wget -qO- http://my-service:5432
Why this works
Confirms whether the dependency the init container requires is reachable.
Kubernetes Documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev