πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Deployments intermediate ⏱ 8 minutes K8s 1.28+

K8s PriorityClass: Pod Scheduling Priority

Configure Kubernetes PriorityClass for pod scheduling priority and preemption. System-critical pods, resource guarantees, and preemption policies.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: Create PriorityClass with a value (0-1000000000): higher = more important. Assign with priorityClassName in pod spec. When resources are scarce, higher-priority pods preempt (evict) lower-priority ones. Built-in classes: system-cluster-critical (2000000000) and system-node-critical (2000001000). Set preemptionPolicy: Never if a pod should be prioritized for scheduling but shouldn’t evict others.

The Problem

Without priorities, all pods are equal:

  • Critical production pods wait behind batch jobs
  • System components can be evicted by user workloads
  • No guaranteed scheduling order during resource pressure
  • Cluster-critical infrastructure has no protection

The Solution

Create PriorityClasses

# Production β€” highest user priority
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: production-critical
value: 1000000
globalDefault: false
description: "Production-critical workloads"

---
# Standard workloads
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: standard
value: 100000
globalDefault: true           # Default for pods without priorityClassName
description: "Standard workloads"

---
# Batch/background jobs
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: batch-low
value: 10000
preemptionPolicy: Never       # Don't evict others, just queue ahead
description: "Low priority batch jobs"

---
# Best-effort / preemptible
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: preemptible
value: 1000
description: "Can be evicted by any higher-priority pod"

Use PriorityClass

apiVersion: apps/v1
kind: Deployment
metadata:
  name: payment-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: payment
  template:
    metadata:
      labels:
        app: payment
    spec:
      priorityClassName: production-critical
      containers:
      - name: payment
        image: payment:v2
        resources:
          requests:
            cpu: 500m
            memory: 512Mi

Built-in System Priorities

# These exist by default β€” DON'T modify them
kubectl get priorityclasses

# system-node-critical    2000001000   # kubelet, kube-proxy
# system-cluster-critical 2000000000   # CoreDNS, kube-apiserver
# User range: 0 β€” 1000000000

# Example: CoreDNS uses system-cluster-critical
kubectl get deployment coredns -n kube-system -o jsonpath='{.spec.template.spec.priorityClassName}'
# system-cluster-critical

Preemption Flow

Scenario: Cluster at capacity, high-priority pod created

1. Scheduler tries to place high-priority pod β†’ no room
2. Scheduler finds nodes with lower-priority pods
3. Lower-priority pods evicted (graceful termination)
4. High-priority pod scheduled on freed resources
5. Evicted pods go back to Pending (rescheduled if room)

Note: Preemption respects PDB β€” won't violate PodDisruptionBudgets

ResourceQuota with Priority

# Limit how many high-priority pods a namespace can create
apiVersion: v1
kind: ResourceQuota
metadata:
  name: production-quota
  namespace: team-a
spec:
  hard:
    pods: "10"
    requests.cpu: "20"
  scopeSelector:
    matchExpressions:
    - scopeName: PriorityClass
      operator: In
      values: ["production-critical"]

Common Issues

Low-priority pods constantly evicted

Too many high-priority workloads. Review priority assignments β€” not everything is β€œcritical.”

Preemption not happening

preemptionPolicy: Never set on the PriorityClass, or PDB protects the lower-priority pods.

All pods use highest priority

Teams gaming the system. Use ResourceQuota with PriorityClass scope to limit high-priority pod counts.

Best Practices

  • 3-5 priority tiers β€” system, production, standard, batch, preemptible
  • Set globalDefault: true on standard tier β€” pods without priority get a reasonable default
  • preemptionPolicy: Never for batch jobs β€” prioritize scheduling without evicting
  • Combine with ResourceQuota β€” prevent priority abuse
  • Don’t use values > 1000000000 β€” reserved for system classes

Key Takeaways

  • PriorityClass assigns scheduling priority; higher values scheduled first
  • Preemption evicts lower-priority pods to make room for higher-priority ones
  • Built-in system classes protect cluster infrastructure
  • preemptionPolicy: Never = priority without eviction
  • Use 3-5 tiers and set a globalDefault for unprioritized pods
#priority #preemption #scheduling #resource-management #cka
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens