kubectl describe node master.k8s
... ...
Taints: node-role.kubernetes.io/master:NoSchedule
kubectl describe po kube-proxy-80asd -n kube-system ... ... Tolerations: node-role.kubernetes.io/master=:NoSchedule node.alpha.kubernetes.io/notReady=:Exists:NoExecute node.alpha.kubernetes.io/unreachable=:Exists:NoExecute ... ... 第一个污点容忍度匹配了某个节点的污点,表示允许这个 pod被调度到具有该污点的节点上。 kubectl get po kube-proxy-80asd -o yaml -n kube-system ... ...
Tips:
• NoSchedule 表示如果 pod 没有容忍这些污点, pod 则不能被调度到包含这些污点的节点上。
• PreferNoSchedule 是NoSchedule 的一个宽松的版本, 表示尽量阻止pod 被调度到这个节点上,但是如果没有其他节点可以调度,pod依然会被调度到这个节点上。
• NoExecute 不同于 NoSchedule 以及 PreferNoSchedule, 后两者只在调度期间起作用, 而 NoExecute 也会影响正在节点上运行着的 pod。 如果在一个节点上添加了
NoExecute 污点, 那些在该节点上运行着的 pod, 如果没有容忍这个 NoExecute 污点, 将会从这个节点去除。
$ kubect1 taint node nodel.k8s node-type=production:NoSchedule
apiVersion: extensions/vlbetal kind: Deployment metadata: name: prod spec: replicas: 5 template: spec: ... ... tolerations: - key: node-type operator: Equal value: production effect: NoSchedule
节点可以拥有多个污点信息,而pod也可以有多个污点容忍度。正如你所见,污点可以只有一个key和 一 个效果,而不必设置value。污点容忍度可以通过设置Equal操作符来指定匹配的value (默认情况下的操作符),或者也可以通过设置Exists操作符来匹配污点的key。
notice: 当前这是一个 alpha阶段的特性,在未来的Kubemetes版本中可能会有所改变。基于污点信息的pod剔除也不是默认启用的, 如果要启用这个特性, 需要在
原文:https://www.cnblogs.com/fanggege/p/12259795.html