Node Affinity types
This defines the behaviour of the scheduler with respective Node Affinity and the stages in the lifecycle of the Pod. There are currently those types of Node Affinity available:
- requiredDuringSchedulingIgnoredDuringExecution
- preferredDuringSchedulingIgnoredDuringExecution
- requiredDuringSchedulingRequiredDuringExecution
There are two states in the lifecycle of the Pod when considering Node Affinity:
- DuringScheduling - when the Pod does not exist and it is created for the first time
- DuringExecution - is the state when the Pod has been running and the change was made to environment that affects Node Affinity (for example - remove the label of a node)
DuringScheduling:
- Required - the scheduler will mandate to place the Pod on a node with given Affinity rules. If it cannot find one - the pod will not be scheduled.
- Preffered - used in cases if the Pod placement on a running node is less important than running the workload itself. In cases then the matching node is not found - the scheduler will simply ignore Affinity rules and will try to place the Pod on any available node
DuringExecution:
- Ignored - pods will continue to run, and any changes to Node Affinity will not impact them once them are scheduled
- Required - will evict any Pods that are running on a nodes that do not meet the Affinity rules. In simple words, if the label of a node will be deleted, any Pods which uses this label in Affinity rules will be evicted.