liveBook · Manning

Priority-based scheduling

As explained in Kubernetes for Developers

Priority is an integer value assigned to a Pod that influences its scheduling order and eviction ranking.

Priority-based scheduling assigns each Pod an integer priority through a PriorityClass. Kubernetes uses that value to rank Pods for scheduling, eviction, and, when configured, preemption. Priority helps critical workloads compete for limited cluster capacity, but it does not protect a Pod that exceeds its resource requests. section 5.1.3

When resources are constrained, Kubernetes applies these rules:

  • Best-effort Pods are especially vulnerable because they have no resource requests. section 5.1.3
  • Among Pods using more than requested resources, priority is considered before excess usage. section 5.1.3

Assigning priority to a Deployment

Create a PriorityClass such as high-priority with value 1000000, then set priorityClassName: high-priority in the Deployment’s Pod template. Use preemptionPolicy: Never when the priority should rank workloads without displacing lower-priority Pods.

How Kubernetes for Developers covers it

How deep it goes
Defines integer priorities and ranking behavior, then demonstrates PriorityClass and Deployment configuration.
Examples
Uses high-priority YAML, a three-replica timeserver Deployment, and alternative preempting and non-preempting policies.
What it assumes
Assumes Pods and resource requests, while establishing PriorityClass and priority behavior directly.
What you can do after
Configure Pod priority with PriorityClass and priorityClassName, including whether lower-priority Pods may be preempted.
How it connects
Connects PriorityClass with Pods, Deployments, resource requests, QoS classes, eviction, and preemption.

Also explained in

Compare how 2 books explain priority-based scheduling →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.