Skip to content
tezvyn:

Pod Priority: Deciding Who Gets Evicted in Kubernetes

Source: kubernetes.ioHardHow cards are made

Pod Priority: Deciding Who Gets Evicted in Kubernetes

Pod Priority is a VIP pass for your critical workloads, telling the scheduler which pods can bump others off a node. This ensures system-critical services run even on a full cluster. The footgun: high-priority pods can cause cascading evictions if not planned.

Why it exists

In a busy Kubernetes cluster, not all workloads are equal. A non-essential batch job could occupy resources needed by a critical API server. Without a way to signal importance, the scheduler might make poor trade-offs. Pod Priority and Preemption were created to solve this by letting you define a clear hierarchy for resource contention.

The mental model

Think of it like airline boarding groups. Every pod is a passenger, but some have a Group 1 ticket (high priority) and others have Group 5 (low priority). When the plane (a node) is full, a Group 1 passenger can still get on. The airline will bump a standby passenger (a low-priority pod) to make room. The PriorityClass object is the boarding pass that shows your group number.

How it works

You first create a cluster-level PriorityClass object, which contains a name and an integer value. Higher values mean higher priority. You then assign this class to a pod via the priorityClassName field in its spec. When a high-priority pod is pending and there's no space, the scheduler identifies a node with lower-priority pods. It then preempts (evicts) one or more of them to make room for the more important pod. The evicted pods are terminated gracefully.

When to use it

Use it to protect critical system components like CoreDNS, CNI plugins, or your monitoring stack. It's also vital for ensuring your most important user-facing applications have precedence over less critical background jobs. In a shared cluster, you can use it to give production workloads priority over staging or development workloads.

When not to use it

Avoid applying priority to every pod. If everything is high-priority, the system becomes meaningless—this is called 'priority inflation'. Don't use it as a substitute for proper capacity planning or autoscaling. If your cluster is constantly preempting pods, it's a sign that it's chronically under-provisioned and you should add more nodes.

One canonical example

A common pattern is creating a system-cluster-critical PriorityClass with a very high value (e.g., 2,000,000,000). This class is then applied to essential Kubernetes add-ons. This ensures that even if a user fills the cluster with low-priority pods, core services can always be scheduled and will not be evicted, preventing a total cluster meltdown.

Interview question

What is the primary mechanism by which Pod Priority ensures critical workloads run on a full Kubernetes node?

  • a.It instructs the scheduler to evict lower-priority pods to free up necessary resources.Correct
  • b.It prevents any new low-priority pods from being scheduled on the node until space is available.
  • c.It reserves a dedicated portion of node resources exclusively for high-priority pods.
  • d.It triggers the automatic provisioning of new nodes to accommodate the critical workload.
Why?

The card explicitly states that when a high-priority pod needs space on a full node, the scheduler preempts (evicts) lower-priority pods to make room. Option C is incorrect because Pod Priority enables eviction, not resource reservation.

Just read this? Test yourself on what you have been reading.

Read the original → kubernetes.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.

See open roles