Skip to main content

Evictions & Node Pressure

Key Takeaways for AI & Readers
  • Node Stability Mechanism: Evictions are a critical Kubelet function to maintain node stability by proactively terminating Pods when resource pressures are high.
  • Resource Thresholds: Evictions are triggered when node resources (memory, disk space) fall below predefined thresholds.
  • QoS-Based Prioritization: Pods are evicted based on their Quality of Service (QoS) class, with BestEffort Pods being the first to be terminated, followed by Burstable, and Guaranteed Pods being the last.
  • Graceful vs. Immediate: Evictions can be configured as "soft" (with a grace period) or "hard" (immediate termination) depending on the criticality and nature of the resource pressure.

Eviction is the process where the Kubernetes Kubelet proactively kills pods to preserve node stability. This is different from a standard deletion—it's a "survival mode" for the node.

1. Node Pressure Simulation

Increase the memory pressure below. Notice that pods are killed starting from the least important ones.

0%
📦
Running
📦
Running
📦
Running
📦
Running
📦
Running
When a node runs out of resources (Memory/Disk), the Kubelet starts Node-Pressure Eviction. It kills pods based on their QoS class to prevent the node from crashing.

2. When does it happen?

The Kubelet monitors resource thresholds:

  • memory.available < 100Mi
  • nodefs.available < 10%
  • imagefs.available < 15%

3. The Order of Death (QoS)

The Kubelet uses the QoS Class to decide which pods to evict first:

  1. BestEffort: First to go. These pods have no requests or limits.
  2. Burstable: Next to go. These pods have usage exceeding their requests.
  3. Guaranteed: Last to go. These pods have Requests == Limits. They are only evicted if the node absolutely has no other choice.

4. Soft vs. Hard Eviction

  • Hard Eviction: Kubelet kills the pod immediately without waiting for grace periods.
  • Soft Eviction: Kubelet waits for a grace period before killing the pod.