Member-only story
Pod Priority and PriorityClass
in Kubernetes
In Kubernetes, Pod Priority is a mechanism that determines the importance of a Pod relative to others in the cluster. Higher-priority Pods are scheduled before lower-priority Pods, and in cases of resource shortages, lower-priority Pods can be evicted to make room for higher-priority ones. This feature is particularly useful for ensuring critical workloads are scheduled even in times of high resource contention.
The PriorityClass object defines the priority level for a Pod. Pods with higher priority are more likely to get resources, and lower-priority Pods may be preempted (killed) to free resources for higher-priority Pods.
Key Concepts
- PriorityClass: A cluster-scoped resource that defines the priority of Pods. It is assigned to Pods by referencing the
PriorityClassName
field in a Pod's specification. - Pod Preemption: If a higher-priority Pod cannot be scheduled due to resource constraints, lower-priority Pods may be evicted to make room.
Section 1: Defining a PriorityClass
A PriorityClass is defined by a numeric value (the higher the value, the higher the priority) and an optional description. Kubernetes comes with some default PriorityClasses, like system-cluster-critical
and system-node-critical
, used by…