Kubernetes Exit Codes Explained: 137, 139, 143 and How to Fix Them Kubernetes exit codes 137, 139, and 143 indicate container crashes caused by OOM kills, segmentation faults, and SIGTERM signals respectively. The article explains how to diagnose these codes using kubectl commands and provides a diagnostic loop to identify root causes and prevent recurrence. Key takeaways - Exit codes in containers follow the POSIX formula: values above 128 equal 128 + the signal number that killed the process. - Exit code 137 means OOMKilled https://cast.ai/blog/oomkilled-exit-code-137/ — the kernel sent SIGKILL because the container exceeded its memory limit. No graceful shutdown, no cleanup. But exit code 137 can also mean the grace period expired: check the Reason field to tell them apart. - Exit code 139 is a segmentation fault SIGSEGV, signal 11 . Usually a null pointer dereference, buffer overflow, or a crash in a native extension like NumPy or TensorFlow. - Exit code 143 is SIGTERM signal 15 — Kubernetes is terminating the pod. If your app doesn’t shut down cleanly within terminationGracePeriodSeconds default 30s , check your ENTRYPOINT form: shell-form sh -c silently eats the signal. - Exit code 127 means the binary wasn’t found at startup. Wrong CMD, wrong base image, or a PATH mismatch after switching from ubuntu to alpine. - Use the Exit Code Diagnostic Loop — Identify → Classify → Fix → Prevent — to move from CrashLoopBackOff to confirmed root cause without guessing. Your pod crashed. STATUS shows CrashLoopBackOff , RESTARTS is climbing. The first question is always the same: what exit code? Exit codes are integers returned by a container process when it terminates — zero means success, anything above 128 means the process was killed by an OS signal the formula is 128 + signal number, per the POSIX standard . Kubernetes surfaces these under Last State in kubectl describe pod . Three codes dominate production incidents: 137 OOM killed , 139 segfault , and 143 SIGTERM . This post covers what each means, how to confirm it in under five minutes, and how to stop seeing it. What container exit codes mean in Kubernetes When a Linux process exits, it returns an integer between 0 and 255 to the parent process. The kernel uses values above 128 to communicate signal-based termination: if the process was killed by signal N , the exit status is 128 + N . This is POSIX behavior — not specific to Linux, not specific to Kubernetes, not specific to containers. Kubernetes just exposes it in a place you can query. The container runtime containerd or CRI-O captures the exit code and stores it in the pod status. Kubernetes then surfaces it in two places: kubectl describe pod under Last State → Exit Code , and the lastState.terminated object in the pod spec. The Reason field alongside the exit code is what tells you whether Kubernetes itself triggered the kill OOMKilled, Error, Completed or whether the process exited on its own. The Exit Code Diagnostic Loop gives you a repeatable path through any crash: Identify which pod and container crashed; Classify the exit code and reason from kubectl describe ; Fix the immediate cause using the logs and events; Prevent recurrence by addressing the root condition — whether that’s a memory limit, a signal handling bug, or a Dockerfile error. The five commands below cover the Identify and Classify steps in full. Step 1: Identify — find pods with restarts or bad status kubectl get pods -n