Hands-on labs: https://uklabs.kodekloud.com/topic/node-affinity-3/
Assure that pods are running in particular Nodes.
Node Affinity increases the complexity. The previous example with pods.spec.nodeSelector.size: Large
would be something like this:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: size
operator: In
values:
- Large
Other possibilities
# Large OR Medium
- key: size
operator: In
values:
- Large
- Medium
---
# NOT Small
- key: size
operator: NotIn
values:
- Small
---
# label 'size' simply exists, no matter its value
- key: size
operator: Exists
requiredDuringSchedulingIgnoredDuringExecution
preferredDuringSchedulingIgnoredDuringExecution
requiredDuringSchedulingRequiredDuringExecution
(planned to be implemented)