Troubleshooting guide
Kubernetes OOMKilled (exit code 137)
OOMKilled means the container used more memory than its limit and the kernel killed it. Either the limit is too low for normal work, or something is leaking.
3 min read9 sectionsUpdated
On this page
Key points
- Exit code 137 = SIGKILL; Reason OOMKilled confirms memory.
- The limit is a hard ceiling; the request is what the scheduler reserves.
- Runtimes need tuning to the limit: JVM, Node and Python do not always respect cgroup limits by default.
- Plot memory per pod over time to tell a leak from a spike.
| Setting | Effect | Guidance |
|---|---|---|
| requests.memory | Used to schedule the pod on a node with that much free | Set to typical steady usage |
| limits.memory | Hard ceiling; exceeding it kills the container | Peak usage plus headroom (often 20 to 50%) |
| No limit | Can use node memory until the node itself runs out | Risky: one pod can starve others |
| Pattern over 24 hours | Likely cause | Fix |
|---|---|---|
| Steady climb, killed at the limit, repeats | Memory leak | Heap profiling; see the Node.js leak guide |
| Flat, then sudden spike at certain requests | Large payloads, big queries, image processing | Stream, paginate, cap input sizes |
| Flat but close to the limit | Limit too low for normal work | Raise the limit and request |
| Killed right at startup | Runtime reserves more than the limit | Tune heap settings to the container |
# JVM: size the heap as a share of the container limit
JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75"
# Node.js: cap the V8 old-space heap (MiB) below the container limit
NODE_OPTIONS="--max-old-space-size=768" # for a 1 GiB limit
# Python (gunicorn): fewer workers, or recycle workers to contain slow leaks
gunicorn app:app --workers 2 --max-requests 1000 --max-requests-jitter 100Alert before the kill
Alert when a pod's memory stays above 85 to 90% of its limit for several minutes, and when restart counts rise. VitalRix infrastructure monitoring shows memory against limits for every pod and can alert per instance, so one leaking pod is caught even when others are fine. Pair it with APM deploy markers to see which release started the growth.
Can a pod be OOMKilled without hitting its own limit?
Yes. If the node runs out of memory, the kernel and kubelet evict or kill pods, starting with those using the most beyond their requests. Set requests realistically.
Should I remove memory limits?
Usually not. Without limits a leak in one pod can take down the whole node. Set limits with headroom and fix leaks.
Related reading
- Exit code 137: what it means in Docker and Kubernetes: Exit code 137 means a container received SIGKILL. Learn to tell memory limits from slow shutdowns and manual kills, with Docker and Kubernetes commands.
- Linux OOM killer: why it killed your process: Understand the Linux OOM killer: read the kernel log to see what was killed and why, how oom_score works, and how to protect critical services from it.
- PHP "Allowed memory size exhausted": how to fix it: Fix PHP Fatal error: Allowed memory size exhausted. Read the error correctly, raise memory_limit for the right SAPI and stop loading big data into arrays.
- Java memory usage: heap, metaspace and leaks: Understand Java memory usage: heap, metaspace, threads and direct memory, why RSS exceeds -Xmx, how to size for containers.
- CreateContainerConfigError in Kubernetes: how to fix it: Fix Kubernetes CreateContainerConfigError: missing Secrets and ConfigMaps, wrong keys and namespaces, with kubectl commands that show exactly what is absent.
- JavaScript heap out of memory: how to fix it in Node.js: Fix FATAL ERROR: JavaScript heap out of memory. Set --max-old-space-size correctly, handle build-time failures and find runtime leaks with heap snapshots.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.