# Kubernetes: OOMKilled (exit code 137)

**Code:** `OOMKilled` · **Category:** Kubernetes · **Seen on:** Kubernetes, Docker, Node.js

The container used more memory than its limit, and the kernel killed it.

## Meaning

Memory limits are hard caps. When exceeded, the container is killed immediately (exit 137) — no graceful shutdown, often without application logs.

## Common causes

- Memory limit too low for the workload
- Memory leak
- Runtime not container-aware (old JVMs, Node default heap)
- Spikes from large requests/batch jobs

## Quick fix

1. Confirm: `kubectl describe pod` → Last State: OOMKilled
2. Raise `resources.limits.memory` after measuring real usage (`kubectl top pod`)
3. Make runtimes respect limits (`-XX:MaxRAMPercentage`, `--max-old-space-size`)

## Detailed fix by platform

### Kubernetes

1. Resources:

```yaml
resources:
  requests: { memory: "256Mi", cpu: "100m" }
  limits:   { memory: "512Mi" }
```


### Node.js

1. `NODE_OPTIONS=--max-old-space-size=384` for a 512Mi limit.

## How to diagnose

1. **Reason** — OOMKilled in Last State?
2. **Usage** — Actual memory over time?
3. **Runtime** — Heap sized to the limit?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/kubernetes/oomkilled)
