OpsCanary
kubernetesschedulingPractitioner

Mastering Pod Priority and Preemption in Kubernetes Scheduling

5 min read Kubernetes DocsAug 30, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

In a dynamic environment, resource allocation can become a significant challenge. Kubernetes addresses this with Pod Priority and Preemption, allowing you to prioritize certain pods over others. This feature is crucial when you have critical applications that must run, even when resources are tight. By using PriorityClasses, you can define which pods should be scheduled first, ensuring that your most important services remain operational.

When a pod is created, it enters a scheduling queue. The Kubernetes scheduler attempts to place it on a node that meets its requirements. If no suitable node is found, preemption logic kicks in. This logic identifies lower-priority pods on nodes and can evict them to free up resources for the higher-priority pod. You can define a PriorityClass with a specific integer value, and the default preemption policy allows these higher-priority pods to preempt lower-priority ones. For instance, you can create a PriorityClass named high-priority with a value of 1000000 to ensure that it takes precedence over others.

In production, be aware of the potential for abuse. A malicious user could create pods with the highest priority, leading to resource starvation for lower-priority pods. Kubernetes includes built-in PriorityClasses like system-cluster-critical and system-node-critical to help manage essential components. Note that if you upgrade an existing cluster without this feature, the priority of your existing pods defaults to zero. Additionally, setting a PriorityClass with globalDefault to true does not retroactively change existing pod priorities, which can lead to confusion if not managed properly.

Key takeaways

  • Define PriorityClasses to prioritize critical workloads effectively.
  • Use preemption logic to free up resources for higher-priority pods.
  • Be cautious of potential abuse by untrusted users creating high-priority pods.
  • Understand that existing pods default to zero priority if the feature was not enabled during cluster creation.
  • Leverage built-in PriorityClasses for managing essential Kubernetes components.

Why it matters

In production, ensuring that critical applications have the resources they need can prevent downtime and performance degradation. Properly configured Pod Priority and Preemption can significantly enhance the reliability of your services during resource contention.

Code examples

chroma
apiVersion:scheduling.k8s.io/v1kind:PriorityClassmetadata:name:high-priorityvalue:1000000globalDefault:falsedescription:"This priority class should be used for XYZ service pods only."
chroma
apiVersion:scheduling.k8s.io/v1kind:PriorityClassmetadata:name:high-priority-nonpreemptingvalue:1000000preemptionPolicy:NeverglobalDefault:falsedescription:"This priority class will not cause other pods to be preempted."
chroma
apiVersion:v1kind:Podmetadata:name:nginxlabels:env:testspec:containers:-name:nginximage:nginximagePullPolicy:IfNotPresentpriorityClassName:high-priority

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
Linux FoundationSponsor

Industry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.

Get CKA certified →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.