Fix Kubernetes OOMKilled (exit code 137)¶
Short answer: OOMKilled means the container exceeded its memory limit and
the kernel killed it (exit code 137). Confirm with kubectl describe pod (Reason:
OOMKilled), then either raise the memory limit to fit real usage or fix the
leak/over-allocation in the app. Right-size using actual usage, not a guess.
Last reviewed: 2026-06-27.
Diagnose it¶
kubectl describe pod <pod> -n <ns> # Last State: Terminated, Reason: OOMKilled, exit 137
kubectl top pod <pod> -n <ns> # current memory vs limit (needs metrics-server)
kubectl get pod <pod> -n <ns> -o jsonpath='{.spec.containers[*].resources}'
Causes & fixes¶
| Cause | Fix |
|---|---|
| Limit set too low for real usage | raise resources.limits.memory to ~1.5× peak |
| Memory leak | fix the app; a higher limit only delays the kill |
| Burst/load spike | raise the limit and/or add an HPA |
| JVM/Node not heap-aware | set -Xmx / --max-old-space-size below the container limit |
requests == limits too tight |
give headroom between request and limit |
Fix it (on the controller)¶
# right-size the Deployment (pods are immutable — patch the controller)
kubectl set resources deploy/<name> --limits=memory=512Mi --requests=memory=256Mi -n <ns>
Pick the number from real usage (kubectl top, or your metrics) plus headroom — not
a round guess. Too high wastes node capacity; too low re-OOMs.
How Karakuri fixes it for you¶
Karakuri detects the OOM kill in real time,
identifies it as the root cause with an LLM, and proposes a right-sized set
resources command on the owning Deployment as a one-click Slack fix — dry-run
previewed, signed, audited, then verified once the rollout is healthy. No Prometheus
required. Try it free: make demo.
FAQ¶
What is exit code 137? 128 + 9 (SIGKILL) — the OOM killer sent SIGKILL when the container hit its memory limit.
Limit vs request? The limit is the hard cap that triggers OOMKilled; the request is what the scheduler reserves. OOM is about the limit.
Will raising the limit always fix it? Only if it was genuinely under-provisioned. A real leak needs an app fix — a bigger limit just postpones the kill.