Taints and Tolerations 是pod的一个属性,它将允许某些pod在指定的节点上或者不允许指定的pod到指定节点上或者必须要有某些的pod才能调度到指定节点上

可以通过​​kubectl taint​​​ 来执行
例如

添加 Taints and Tolerations

kubectl taint nodes node1 key=value:NoSchedule

-------node1:节点名称
-------key 就是key
-------value 就是value
-------效果是 NoSchedule意思是说只有拥有: key=value:NoSchedule这个属性的pod才能调度到node1上

删除Taints and Tolerations

kubectl taint nodes node1 key:NoSchedule-

该属性是在​​PodSpec​​下,只有这个值才能被调度到node1上

tolerations:
- key: "key"
operator: "Equal"
value: "value"
effect: "NoSchedule"
tolerations:
- key: "key"
operator: "Exists"
effect: "NoSchedule"

以上表示只有key=’key’ value=’value’ 或者 存在key=’key’的pod才会调度到node1上

​Operator​​​默认是​​Equal​

tolerations:
-operator: "Exists"这中情况 Exists的空键匹配所有的键,值和效果,这意味着这将容忍一切
tolerations:
- key: "key"
operator: "Exists"
匹配key="key"键关键字的所有效果。
kubectl taint nodes node1 key1=value1:NoSchedule
kubectl taint nodes node1 key1=value1:NoExecute
kubectl taint nodes node1 key2=value2:NoSchedule

pod要生成以下

tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoExecute"

未完待续

参考
​​​taint-and-toleration​