【Kubernetes 016】pod调度之Taint和Toleration

上一节学习的Affinity是在pod创建的时候设置的,但是随着pod的数目越来越多,更有效率的方式应该是在node端设置一些记号,pod默认就不会调度在这个node上,而只有一些经过特殊设置的pod才可以在该node调度。这就是这一节要学习的Taint和Toleration。

我是T型人小付,一位坚持终身学习的互联网从业者。喜欢我的博客欢迎在csdn上关注我,如果有问题欢迎在底下的评论区交流,谢谢。

Taint

Taint,污点,是在node上的一个设置,格式如下

key=value:effect

其中value可以为空,effect是该污点所对应的对pod的动作,可以为如下的一种

  • NoSchedule - 表示k8s将不会将pod调度到具有该污点的node
  • PreferNoSchedule - 表示k8s尽量避免将pod调度到具有该污点的node
  • NoExecute - 表示k8s将不会将pod调度到具有该污点的node,并且该node上已存在的pod还会被驱逐(如果是控制器创建的pod会在别的node被重新创建)

污点设置和删除命令举例如下

# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'.
 # If a taint with that key and effect already exists, its value is replaced as specified.
 kubectl taint nodes foo dedicated=special-user:NoSchedule

 # Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists.
 kubectl taint nodes foo dedicated:NoSchedule-

 # Remove from node 'foo' all the taints with key 'dedicated'
 kubectl taint nodes foo dedicated-

 # Add a taint with key 'dedicated' on nodes having label mylab
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值