一、污点(Taint)
污点是用来配置节点亲和性的,是Pod的一种属性(偏好),它使Pod被吸引到某一类特点的节点,也就是说我想让Pod被调度到指定的节点
应用场景:把Nginx服务调度到Node1节点,Tomcat服务调度到Node2节点,其它服务在没有配置容忍的情况下,不会被调度到Node1和Node2
具体方法:
1、在Node1节点添加污点设置app=nginx:NodSchedule,在Node2节点添加app=tomcat:NodSchedule
kubectl taint node node1 app=nginx:NoSchedule
kubectl taint node node2 app=tomcat:NoSchedule
2、在Deployment添加容忍
Equal和Exists是两种不同的操作符类型:总的来说,Equal需要污点的键和值都匹配,而Exists只需要污点的键存在即可匹配,不关注其具体值
tolerations: - key: "app" operator: "Equal" value: "nginx" effect: "NoSchedule"
tolerationSeconds: 60
tolerations: - key: "app" operator: "Equal" value: "tomcat" effect: "NoSchedule"
tolerationSeconds: 60
删除节点上的污点配置
kubectl taint node node1 app=nginx:NoSchedule-
查看节点上的污点配置
kubectl describe node node1|grep taint
标签:kubectl,容忍,app,taint,NoSchedule,污点,K8S,节点 From: https://www.cnblogs.com/hm1825/p/18002924