Member-only story
Understanding Kubernetes: Part 26 Preemption and Priority
📢 If you’ve been following our Kubernetes series 2025, welcome back! For new readers, check out Part 25: Affinity and Anti-Affinity
📖 Not a Medium member? No worries! Here’s the free link: Part 26 — Preemption and Priority
What is a Pod Priority?
A Pod Priority defines the importance of a Pod relative to others. Higher-priority Pods get scheduled before lower-priority ones. If resources are insufficient, Kubernetes may preempt (evict) lower-priority Pods to make room for higher-priority ones.
Defining a Pod Priority Class
Pod priorities are defined using PriorityClasses, which assign numerical values to indicate importance.
Example: Creating a Priority Class
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000
preemptionPolicy: PreemptLowerPriority
globalDefault: false
value
: Determines the priority level; higher values indicate higher priority.preemptionPolicy
: Defines whether the Pod can preempt lower-priority Pods (PreemptLowerPriority
).globalDefault
: Iftrue
, this priority applies to all Pods by default.