Sub topic 11
System Priority Classes and Critical Pods
This chapter assumes you can write a PriorityClass and set priorityClassName on a Pod. It also assumes you know that the scheduler uses priority to order the queue and to preempt. Here you will see the two PriorityClasses Kubernetes creates for you and why they sit above anything you can define.
The two built-in classes
Every cluster ships with two PriorityClasses for components the cluster cannot run without:
| Name | Value | Typical use |
|---|---|---|
| `system-cluster-critical` | 2000000000 | Cluster-wide add-ons, such as DNS |
| `system-node-critical` | 2000001000 | Components that must run on every node, such as kube-proxy |
Both values are above 1,000,000,000. The API server rejects a user-defined PriorityClass with a value above that limit. Names starting with system- are also reserved. This keeps ordinary workloads from outranking the control plane's essential Pods.
You can list them with:
kubectl get priorityclassYou will see these two next to any classes you created. Pods that do not name a class get priority 0, unless a class has globalDefault: true.
Using a system class
Assign a system class like any other PriorityClass:
apiVersion: v1
kind: Pod
metadata:
name: dns-helper
namespace: kube-system
spec:
priorityClassName: system-cluster-critical
containers:
- name: app
image: nginx:1.27
resources:
requests:
cpu: "100m"
memory: 64Mi
limits:
cpu: "100m"
memory: 64MiThe scheduler treats this Pod as extremely high priority. If no node has room, it can preempt lower-priority Pods to make space. The caveats from the preemption chapter still apply.
What "critical" means on the node
The kubelet also treats some Pods as critical. A Pod counts as critical if it is a static Pod, a mirror Pod, or has priority of 2000000000 or higher. This has two effects:
- The kubelet's admission check can evict other Pods to make room for a critical Pod. This happens on the node, separately from scheduler preemption.
- The kubelet's node-pressure eviction skips critical Pods, so they are not chosen as eviction victims.
This is why a system priority class protects a Pod in more than one place. It affects scheduling order, preemption, and eviction.
Common mistakes
- Setting a user class value above 1,000,000,000 and getting a validation error. Pick a lower value.
- Assuming a system class changes the QoS class. It does not. A system-critical Pod with no requests is still BestEffort, and its
oom_score_adjstill follows the QoS rules. Set requests and limits as well. - Giving many Pods a system class. They compete with each other on equal footing and can preempt each other, so you lose the protection you wanted.
Exercise
You want a monitoring agent that runs on every node to be scheduled ahead of everything else and to survive node-pressure eviction. Which built-in class fits, and what else should you set so the Pod is not first in line for an OOM kill?
Show answer
Use system-node-critical, because the agent runs on every node. Priority does not change the QoS class, so also set memory and CPU requests equal to limits. That makes the Pod Guaranteed and gives it a low oom_score_adj.