CrashLoopBackOff is not an error itself—it is Kubernetes telling you that a container inside your Pod keeps starting, crashing, and waiting for an exponential backoff delay (10s, 20s, 40s, up to 5 minutes) before restarting again.
30-Second kubectl Diagnosis
Skip guessing and run these three commands in order to capture the exact exit code and crash logs before the container restarts again:
# 1. Check Last State & Exit Code (look for Reason: OOMKilled or Error)
kubectl describe pod -n
# 2. Fetch logs from the PREVIOUS crashed container instance
kubectl logs -n --previous --tail=100
# 3. Check cluster-level events sorted by time
kubectl get events -n --sort-by='.lastTimestamp'
Top 6 Root Causes & Exact Fixes
Exit Code
137(OOMKilled): The container exceeded its memory limit. Increaseresources.limits.memoryor tune JVM/runtime heap using our JVM Container Memory Calculator.Exit Code
1(Application Error): Missing environment variable, bad database connection string, or invalid config file. Check--previouslogs and verify ConfigMaps/Secrets.Aggressive
livenessProbe: Your app takes 45s to warm up, butlivenessProbekills it at 15s. Move slow startup checks tostartupProbewith a higherfailureThreshold.Exit Code
127/126(Entrypoint / Permission Error): Wrong binary path incommand, missing executable bit, orreadOnlyRootFilesystem: trueblocking temp file writes without anemptyDirvolume.Missing Dependency on Boot: App crashes immediately if Redis/DB isn't reachable yet. Add an
initContainerwait check or implement startup retry logic.Broken Volume Mount Permissions: Running as non-root (
runAsUser: 1000) while mounting a root-owned PVC; fix withsecurityContext.fsGroup.
Production Probe Fix Pattern
startupProbe:
httpGet:
path: /healthz
port: 8080
failureThreshold: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 10
failureThreshold: 3
Next step: Verify your Pod's memory limits and eviction protection with our free Kubernetes QoS Class Checker.
Originally published at OpsHubs. Found it useful? Buy us a coffee ☕.
Top comments (0)