一 、 nodeAffinity
Similar to nodeSelector, according to the label on the node to schedule the Pod to which nodes
Two, scheduling strategy
Hard strategy (required): must be satisfied, if not satisfied, the Pod is in the Pending state
Soft strategy (preferred): try to satisfy, but not guarantee
操作符:In、NotIn、Exists、DoseNotExist、Gt、Lt
Three, example
3.1.硬策略
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodeType
operator: In
values:
- dev
3.2.软策略
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: nodeType
operator: In
values:
- test
If there is no node with nodeType=test label, it will be scheduled to other nodes, which is more relaxed than the hard policy