Priorities
Priorities
Priorities are functions used to weigh resources. Unless Pod
and node affinity has been configured to the SelectorSpreadPriority
setting, which ranks nodes based on the number of existing running pods, they will select the node with the least amount of Pods. This is a basic way to spread Pods across the cluster.
Other priorities can be used for particular cluster needs. The ImageLocalityPriorityMap
favors nodes which already have downloaded container images. The total sum of image size is compared with the largest having the highest priority, but does not check the image about to be used.
Currently, there are more than ten included priorities, which range from checking the existence of a label to choosing a node with the most requested CPU and memory usage. You can view a list of priorities at master/pkg/scheduler/algorithm/priorities
.
A stable feature as of v1.14 allows the setting of a PriorityClass
and assigning pods via the use of PriorityClassName
settings. This allows users to preempt, or evict, lower priority pods so that their higher priority pods can be scheduled. The kube-scheduler
determines a node where the pending pod could run if one or more existing pods were evicted. If a node is found, the low priority pod(s) are evicted and the higher priority pod is scheduled. The use of a Pod Disruption Budget
(PDB
) is a way to limit the number of pods preemption evicts to ensure enough pods remain running. The scheduler will remove pods even if the PDB is violated if no other options are available.