Pod Priority and Preemption
Learn how PriorityClasses rank Pods and how the scheduler can preempt lower-priority Pods to make room for critical workloads.
Pod Priority and Preemption is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Not All Pods Are Equal
When the cluster is full, some workloads matter more than others. Pod priority lets you tell Kubernetes which Pods should win the competition for resources.
What Is a PriorityClass?
A PriorityClass is a cluster-wide object that maps a name to an integer value. Higher numbers mean higher priority.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
value: 1000000
globalDefault: false
description: 'For critical production workloads'Assigning Priority to a Pod
A Pod opts into a class with priorityClassName. The scheduler reads the numeric value from the referenced class.
apiVersion: v1
kind: Pod
metadata:
name: critical-app
spec:
priorityClassName: high-priority
containers:
- name: app
image: myapp:1.0How Priority Affects Scheduling
When several Pods are pending, the scheduler tries to place higher-priority Pods first. Priority influences the order in which Pods get scheduled.
What Is Preemption?
If a high-priority Pod cannot be scheduled because the cluster is full, the scheduler may preempt (evict) lower-priority Pods to free space.
The evicted Pods go back to Pending and may reschedule elsewhere.
Preemption in Action
Imagine a node is full of priority-100 Pods and a priority-1000000 Pod arrives. The scheduler can remove enough low-priority Pods to fit the critical one.
kubectl get events --field-selector reason=Preempted
# Pod default/batch-job was preempted by critical-appDisabling Preemption
A PriorityClass can opt out of preempting others with preemptionPolicy: Never. Such Pods still schedule by priority order but won't evict anyone.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-no-preempt
value: 1000000
preemptionPolicy: NeverThe Global Default
Setting globalDefault: true on a PriorityClass applies its value to any Pod that does not specify one. Only one class can be the global default.
Built-in System Classes
Kubernetes ships with reserved classes like system-cluster-critical and system-node-critical for essential components. Do not reuse these for your apps.
kubectl get priorityclass
# system-node-critical 2000001000
# system-cluster-critical 2000000000Best Practices
- Define a small number of clear tiers (e.g. critical, normal, batch)
- Reserve preemption for truly important workloads
- Combine with resource requests so scheduling decisions are accurate
- Avoid making everything high priority, which defeats the purpose
Priority vs QoS
Priority controls scheduling and preemption. Quality-of-Service classes (from requests/limits) control eviction under node pressure. They are related but distinct mechanisms.
Quick Check
Test your understanding of preemption.
Recap
You learned that a PriorityClass ranks Pods by an integer value, influencing scheduling order. Preemption lets critical Pods evict lower-priority ones when the cluster is full. Use a few clear tiers and combine priority with accurate resource requests.
Frequently asked questions
Is the “Pod Priority and Preemption” lesson free?
Yes — the full text of “Pod Priority and Preemption” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.
What will I learn in “Pod Priority and Preemption”?
Learn how PriorityClasses rank Pods and how the scheduler can preempt lower-priority Pods to make room for critical workloads. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Pod Priority and Preemption” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Resource Requests and Limits
- Node Selectors and Affinity
- Taints and Tolerations
- Pod Priority and Preemption