K8S节点亲和性nodeAffinity
一、nodeAffinity类似于nodeSelector,根据节点上的标签来调度Pod到哪些节点二、调度策略硬策略(required):必须满足,不满足则Pod处于Pending状态软策略(preferred):尝试满足,但不保证操作符:In、NotIn、Exists、DoseNotExist、Gt、Lt三、示例3.1.硬策略affinity:nodeAffinity:requiredDurin
·
一、nodeAffinity
类似于nodeSelector,根据节点上的标签来调度Pod到哪些节点
二、调度策略
硬策略(required):必须满足,不满足则Pod处于Pending状态
软策略(preferred):尝试满足,但不保证
操作符:In、NotIn、Exists、DoseNotExist、Gt、Lt
三、示例
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
如果没有nodeType=test标签的节点,则会调度到其他节点,相对于硬策略,更宽松些
更多推荐
已为社区贡献44条内容
所有评论(0)