OOMKilled and Memory Pressure
What you'll learn: You'll understand what happens when containers consume too much memory and how Kubernetes handles nodes running out of available memory.
What is OOMKilled?
When a container tries to use more memory than its memory limit (which you learned to set in lesson 1335), the Linux kernel's Out-Of-Memory (OOM) killer terminates it immediately. The container's exit code becomes 137, and its restart reason shows OOMKilled. This is a hard stop—no graceful shutdown.
Think of it like a bucket with a line marked "MAX." If you keep pouring water past that line, someone immediately dumps the entire bucket. The container doesn't get a warning; it just dies.
Memory Pressure on Nodes
Memory pressure occurs when a node's total available memory drops below a threshold—regardless of individual container limits. When this happens, the kubelet (the agent running on each node) begins evicting pods to free up memory.
The kubelet uses these thresholds:
memory.available < 100Mi(soft eviction)memory.available < 10%(hard eviction, varies by config)
Pods are evicted in order of their Quality of Service class (from lesson 1336): BestEffort pods go first, then Burstable, and finally Guaranteed pods are evicted only as a last resort.
The Difference
- OOMKilled: One container exceeded its own memory limit → killed immediately
- Memory Pressure Eviction: The entire node is low on memory → pods evicted based on priority
Key Takeaway: OOMKilled happens when a container breaches its memory limit; memory pressure eviction happens when the node runs critically low on total available memory, causing the kubelet to remove lower-priority pods to protect the node's stability.