kubernetes 的 Taints and Tolerations(污点和耐性)

功能
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值