Kubernetes 101 : Pods priority - PriorityClass object -



Pod priority:

We can define a pod's priority using a kubernetes object called the PriorityClass
A pod's priority influences the order in which the scheduler assigns nodes to the pods.

Below is the Yaml file for our PriorityClass with the value of "1000":


- globalDefault: Indicates if kubernetes could use this priority with pods that don't have the priority parameter defined.

The kubernetes "PriorityClass" object:

The PriorityClass is a cluster-wide kubernetes object. The higher its value, the higher the priority of the pods associated with it.
Below is an example of a pod using our PriorityClass object defined above:


When we have a lot of pods waiting to be assigned to the kubernetes nodes, the scheduler takes into consideration the priority of the pods - the pods with higher priority get scheduled first -

Remark:

The scheduler can also terminate lower priority pods - using the default preemption policy in kubernetes and replace them with higher priority ones if the resources are scarce on the nodes.

Comments

Leave as a comment:

Archive