CKA — Pod Priority & Preemption

3 minute read

CKA Exam Domain

Domain Weight
Workloads & Scheduling 15%

Pod priority and preemption questions are less frequent than taints or affinity, but they do appear. Know how to create a PriorityClass and assign it to a Pod.

What Is Pod Priority?

Pod priority lets you assign a numerical priority to Pods. The scheduler uses this value to decide scheduling order:

  • Higher priority Pods are scheduled first.
  • When resources are scarce, the scheduler can preempt (evict) lower-priority Pods to make room for higher-priority ones.

Priority is set through a PriorityClass object.

PriorityClasses

A PriorityClass is a cluster-scoped resource that defines a priority value.

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority
value: 1000000
globalDefault: false
preemptionPolicy: PreemptLowerPriority
description: "Used for critical production workloads."
Field Description
value Integer priority. Higher = more important.
globalDefault If true, this priority applies to Pods that don’t specify one. Only one class can be the global default.
preemptionPolicy PreemptLowerPriority (default) or Never.
description Human-readable description.
kubectl apply -f high-priority-class.yaml
kubectl get priorityclasses

Using PriorityClasses

Reference the PriorityClass in the Pod spec with priorityClassName:

apiVersion: v1
kind: Pod
metadata:
  name: critical-app
spec:
  priorityClassName: high-priority
  containers:
    - name: nginx
      image: nginx:1.27
      resources:
        requests:
          cpu: "500m"
          memory: "256Mi"
kubectl apply -f critical-app.yaml
kubectl describe pod critical-app | grep Priority

Expected output:

Priority:             1000000
Priority Class Name:  high-priority

Preemption

When a high-priority Pod can’t be scheduled because of insufficient resources, the scheduler looks for lower-priority Pods it can evict to free up space.

How preemption works:

  1. High-priority Pod enters the scheduling queue.
  2. Scheduler can’t find a node with enough resources.
  3. Scheduler identifies lower-priority Pods on a candidate node.
  4. Lower-priority Pods are gracefully terminated (respecting terminationGracePeriodSeconds).
  5. High-priority Pod is scheduled on the freed node.

Important: Preemption respects PodDisruptionBudgets (PDBs) on a best-effort basis. The scheduler tries to avoid violating PDBs, but it’s not guaranteed.

PreemptionPolicy

Policy Description
PreemptLowerPriority (Default) Can evict lower-priority Pods when resources are scarce.
Never Will not evict other Pods. Waits until resources become available naturally.

A Never preemption policy is useful for Pods that should have scheduling priority but should never displace running workloads:

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: high-priority-no-preempt
value: 500000
preemptionPolicy: Never
description: "High priority but won't evict other Pods."

System Priority Classes

Kubernetes ships with built-in PriorityClasses for system-critical components:

PriorityClass Value Used By
system-node-critical 2000001000 Critical node-level Pods (kube-proxy, CNI)
system-cluster-critical 2000000000 Critical cluster-level Pods (CoreDNS, metrics-server)

These are the highest possible priorities. User-defined PriorityClasses should use values below 1000000000.

kubectl get priorityclasses

Expected output:

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

Exam Tip: Don’t create PriorityClasses with values higher than 1 billion — that range is reserved for system classes.

kubectl Commands

# List all PriorityClasses
kubectl get priorityclasses

# Describe a PriorityClass
kubectl describe priorityclass high-priority

# Check Pod priority
kubectl describe pod <pod-name> | grep Priority

# Create a PriorityClass from YAML
kubectl apply -f priority-class.yaml

# Delete a PriorityClass
kubectl delete priorityclass high-priority

Practice Questions

Q1. Create a PriorityClass named low-priority with a value of 100 and no preemption. Then create a Pod that uses it.

Show Answer
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: low-priority
value: 100
preemptionPolicy: Never
description: "Low priority, no preemption."
apiVersion: v1
kind: Pod
metadata:
  name: low-pod
spec:
  priorityClassName: low-priority
  containers:
    - name: nginx
      image: nginx:1.27

Q2. What are the two built-in system PriorityClasses? What are their values?

Show Answer
PriorityClass Value
system-cluster-critical 2000000000
system-node-critical 2000001000

Q3. A Pod with priorityClassName: high-priority (value 1000000) is Pending. There are lower-priority Pods on worker-1. What happens?

Show Answer

If the PriorityClass has preemptionPolicy: PreemptLowerPriority (the default), the scheduler will evict one or more lower-priority Pods on worker-1 to make room for the high-priority Pod.

Q4. How do you set a global default PriorityClass?

Show Answer

Set globalDefault: true in the PriorityClass definition. Only one PriorityClass can be the global default.

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: default-priority
value: 0
globalDefault: true

Pods that don’t specify a priorityClassName will use this class.

Q5. What is the difference between PreemptLowerPriority and Never preemption policies?

Show Answer
  • PreemptLowerPriority (default) — The scheduler can evict lower-priority Pods to make room.
  • Never — The Pod will not cause any evictions. It waits in the queue until resources become available on their own.

Updated: