Skip to content

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.

Confirm it

bash
kubectl describe pod <pod> | grep -A5 'Last State'
#   Last State:  Terminated
#     Reason:    OOMKilled
#     Exit Code: 137

kubectl top pod <pod> --containers          # current usage (needs metrics-server)
kubectl get pod <pod> -o jsonpath='{.spec.containers[*].resources}'

Requests and limits

SettingEffectGuidance
requests.memoryUsed to schedule the pod on a node with that much freeSet to typical steady usage
limits.memoryHard ceiling; exceeding it kills the containerPeak usage plus headroom (often 20 to 50%)
No limitCan use node memory until the node itself runs outRisky: one pod can starve others

Leak or undersized?

Pattern over 24 hoursLikely causeFix
Steady climb, killed at the limit, repeatsMemory leakHeap profiling; see the Node.js leak guide
Flat, then sudden spike at certain requestsLarge payloads, big queries, image processingStream, paginate, cap input sizes
Flat but close to the limitLimit too low for normal workRaise the limit and request
Killed right at startupRuntime reserves more than the limitTune heap settings to the container

Tune the runtime to the limit

bash
# 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 100

Alert 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.

Frequently asked questions

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.

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.