McKube 0 requests sent

Kubernetes OOMKilled (Exit Code 137)

Why containers die with Exit Code 137, how Linux cgroup OOM differs from SIGKILL shutdowns, and exact memory limit fixes.

CRITICAL · Exit 137 / OOMKilled

Root Cause

The Linux kernel OOM killer sent SIGKILL (128 + 9 = 137) because container RSS + anonymous memory crossed resources.limits.memory, or kubelet killed the process after terminationGracePeriodSeconds expired.

How to Fix

  • Inspect Last State Reason in kubectl describe pod: OOMKilled confirms memory exhaustion; Error + 137 during rollout points to ignored SIGTERM.
  • Set resources.requests.memory equal to resources.limits.memory so the Pod receives predictable memory reservation and avoids noisy-neighbor node eviction.
  • Cap language runtime heaps below the container cgroup ceiling (-XX:MaxRAMPercentage=75.0 for JVM, --max-old-space-size for Node.js, GOMEMLIMIT for Go).

Diagnostic Commands

kubectl describe pod <pod> -n <ns>
kubectl top pod <pod> -n <ns> --containers
kubectl logs <pod> -n <ns> --previous --tail=100