Cloud Native 11 min read

Why Are Kubernetes Pods Evicted? Preemption, Node Pressure & QoS Explained

This article explains why Kubernetes pods get evicted, covering preemptive eviction, node‑pressure eviction, pod scheduling, priority classes, QoS tiers, alternative eviction methods, and how to monitor evictions with Prometheus, providing concrete commands and examples.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Why Are Kubernetes Pods Evicted? Preemption, Node Pressure & QoS Explained

Pod Eviction Reasons: Preemption and Node Pressure

Kubernetes evicts pods primarily due to resource scarcity, either through preemptive eviction or node‑pressure eviction.

Preemptive Eviction

When a new pod cannot be scheduled because no node has sufficient resources, the kube-scheduler may preempt lower‑priority pods to free space.

Pod Scheduling Process

The scheduler assigns pods to nodes in two steps:

Filtering – selects nodes that satisfy taints, tolerations, and other constraints.

Scoring – assigns a score to each candidate node and picks the highest‑scoring one.

Priority Classes

Priority classes map numeric priority values to pods; higher values mean the pod is less likely to be evicted.

$ kubectl get priorityclasses
$ kubectl get pc

NAME                     VALUE        GLOBAL-DEFAULT   AGE
system-cluster-critical 2000000000   false            2d
system-node-critical    2000001000   false            2d

Priority Example

Three pods represent different fruits. Two priority classes are defined:

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: trueberry
value: 1000000
globalDefault: false
description: "This fruit is a true berry"

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: falseberry
value: 5000
globalDefault: false
description: "This fruit is a false berry"

blueberry gets trueberry (value = 1000000)

raspberry and strawberry get falseberry (value = 5000)

When higher‑priority pods are created, lower‑priority pods (raspberry, strawberry) are evicted, leaving blueberry running.

Node‑Pressure Eviction

Kubelet continuously monitors node resources (CPU, memory, disk). When usage exceeds configured thresholds, it evicts pods based on their QoS class.

QoS Classes

Guaranteed – all containers have identical CPU and memory limits = requests.

Burstable – containers have limits and/or requests but not the strict guarantees of Guaranteed.

BestEffort – no limits or requests are set.

Pods are evicted in this order:

BestEffort or Burstable pods that exceed their requests.

Burstable pods below requests and Guaranteed pods.

Guaranteed pods are rarely evicted unless the system itself needs resources.

Other Eviction Types

API‑Driven Eviction

Use the Kubernetes Eviction API to request eviction of a specific pod. This creates a pods/eviction sub‑resource rather than deleting the pod directly.

Taint‑Based Eviction

Applying a NoExecute taint to a node immediately evicts any pod that does not tolerate the taint.

Node Drain

Mark a node unschedulable with kubectl cordon, then run kubectl drain nodename to evict all pods gracefully.

Monitoring Pod Evictions with Prometheus

Prometheus can expose eviction metrics: kube_pod_status_reason{reason="Evicted"} > 0 Combine with kube_pod_status_phase{phase="Failed"} to see pods that failed and were evicted.

Conclusion

During preemption, Kubernetes evicts lower‑priority pods to make room for higher‑priority ones, controlled via Priority Classes. Node‑pressure eviction relies on QoS classes to decide which pods are safest to terminate. Properly setting limits, requests, and priorities helps keep critical workloads running while optimizing resource usage.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PrometheuspreemptionQoSpod evictionnode pressurepriorityclass
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.