kubectl Crash Simulator
Production is failing. Alerts are firing. Diagnose and fix CrashLoopBackOff, Exit Code 137 OOMKills, Pending PVCs, and broken Services under a 60-second timer.
Cluster Outage Triage Complete
You diagnosed and resolved 8 of 10 production cluster incidents under live timer conditions.
The SRE 4-Step Algorithmic Kubernetes Triage Framework
When an outage alerts you at 2:00 AM, guessing and deleting pods wastes critical time. Follow this deterministic triage sequence engineered for production reliability.
Scope the Blast Radius
Determine whether the incident is isolated to a single pod, spreading across a namespace, or concentrated on a physical worker node.
kubectl get pods -n <namespace> -o wide
Secret / ConfigMap, database credentials, or code panic.
kubectl get nodes), Kubelet service daemon, disk pressure, or CNI pod network.
Inspect Container Lifecycle & Termination States
Read the exact kernel exit signal, verify termination reasons, and inspect recent Kubelet lifecycle events.
kubectl describe pod <pod-name> -n <namespace>
137 (OOMKilled) vs 1 (Runtime Crash) vs 143 (SIGTERM / Eviction).
FailedScheduling, FailedMount, BackOff, or Unhealthy probes.
resources.limits.memory.
Capture Post-Mortem Crash Logs
Extract stdout/stderr from the terminated container instance right before the exit signal was dispatched.
kubectl logs <pod-name> -n <namespace> --previous --tail=100
kubectl logs during CrashLoopBackOff often returns empty because the container is in exponential restart sleep! Always append --previous to capture pre-crash logs.
Verify Dependencies, Endpoints & Event Chronology
Ensure network endpoints are registered and correlate cluster events across the namespace.
kubectl get endpoints <service-name> -n <namespace>
kubectl get events -n <namespace> --sort-by='.metadata.creationTimestamp'
502 / 503 Bad Gateway errors.
Exit Code Rosetta Stone: Decoding Kernel & Kubelet Signals
Before inspecting application logs, the container exit code provides immediate insight into the root failure vector.
| Exit Code | Signal Name | Primary Root Cause | First Diagnostic Command |
|---|---|---|---|
137 |
SIGKILL (128 + 9) | OOMKilled: Container memory exceeded cgroup limits or node ran out of RAM. | kubectl describe pod <pod> | grep -i oom |
143 |
SIGTERM (128 + 15) | Graceful Kill Interrupted: Failed liveness probe or pod eviction timeout. | Check liveness probe initialDelaySeconds and grace periods. |
1 |
Application Error | Runtime Panic: Missing required env var, DB handshake error, or syntax bug. | kubectl logs <pod> --previous |
127 |
Command Not Found | Missing Binary: Entrypoint or command executable not found in image $PATH. | Review Dockerfile base image and script shebang. |
139 |
SIGSEGV (128 + 11) | Segmentation Fault: Memory corruption or C-library mismatch (Alpine vs glibc). | Inspect native compiled dependencies and glibc versions. |
0 |
Success / Clean Exit | Premature Completion: Daemon launched in background; main process exited. | Ensure foreground execution flag (e.g. nginx -g 'daemon off;'). |
📚 Frequently Asked Kubernetes Triage Questions
CrashLoopBackOff is not an error code; it is a Kubernetes state condition. When a container process terminates unexpectedly with a non-zero exit code, the kubelet attempts to restart it. If it crashes repeatedly, the kubelet applies an exponential back-off delay (10s, 20s, 40s up to 5 minutes) before the next restart to avoid overloading node CPU and disk. The application error is the underlying cause, while CrashLoopBackOff is the orchestrator's pacing response.
resources.limits.memory. Run kubectl describe pod <pod-name> and inspect the Last State: Terminated block. If Reason: OOMKilled is present, the process breached its cgroup limit. Resolution requires profiling memory leaks or increasing the container memory limit.
kubectl logs <pod-name> queries the currently running container instance. If the container is currently waiting in its back-off period between restarts, the active container does not exist or has not yet written logs. To inspect the stdout and stderr logs from the failed container instance right before it crashed, pass the --previous flag: kubectl logs <pod-name> --previous.
kubectl get endpoints <service-name> or kubectl get endpointslices. If the ENDPOINTS column shows <none>, the Service's spec.selector labels do not match the Pod's metadata.labels. Align the labels so kube-proxy can register the pod IPs as healthy backend endpoints.
kubectl describe pod <pod-name> and inspect the Events section at the bottom. Common causes include: 1) Insufficient CPU or Memory requests exceeding available allocatable capacity on all nodes; 2) PersistentVolumeClaim (PVC) unbound due to storageClass mismatch or volume binding mode; 3) Unmatched nodeSelector, nodeAffinity, or taints without matching tolerations.