Priority of K8s pods and preemption
kubernetesWhen you specify the priorityClassName of a Pod, the value of the corresponding PriorityClass becomes the Priority of the Pod.
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: low-priority
value: -10
globalDefault: false
description: 'pods can be preempted'
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
priorityClassName: low-priority
When a Pod is scheduled and its preemptionPolicy is the default PreemptLowerPriority, preempt other Pods with a lower priority to reserve requested resources. Priority is also referred on eviction when a node runs out of resources.
If there is no PriorityClass whose globalDefault is true, Pods’ priority is 0 by default. So if you specify PriorityClass which has positive value, note that most Pods including DaemonSets will be preempted.
Pods to be preempted are searched for each node. The following Reason may be included in the FailedScheduling event, and “No preemption victims found for incoming pod” means that No pod with lower priority exists.
0/10 nodes are available:
8 Insufficient cpu,
1 node(s) had untolerated taint {[node.kubernetes.io/not-ready:](http://node.kubernetes.io/not-ready:) },
1 node(s) didn't match Pod's node affinity/selector.
preemption: 0/10 nodes are available:
1 Insufficient cpu,
8 No preemption victims found for incoming pod,
1 Preemption is not helpful for scheduling..