Taint And Tolerations, Nodeselector, Node Affinity

59 阅读1分钟

Taint And Tolerations

Taints 和 Tolerations 是一种让你确保 pod 不会被部署在不恰当节点上的功能。我们可以给节点添加污点,给 pod 添加容忍度。 如何给节点添加污点:

kubectl taint nodes node1 hello=app:NoExecute

共有三种 Effect :

  • NoSchedule : 调度程序将只允许调度对受污染节点具有容忍度的 pod ;
  • PreferNoSchedule :调度程序将尽量避免调度对受污染节点没有容忍度的 pod ;
  • NoExecute : 如果 pod 对受污染的节点没有容忍度,Kubernetes 将从节点中驱逐正在运行的 pod ;

如何给 pod 添加容忍度:

捕获.PNG

Nodeselector

我们可以使用 nodeSelector 在某些特定节点上运行pod

捕获.PNG

## Node Affinity

和Nodeselector类似,也是用于选择节点的:

捕获.PNG