Kubernetes - 在 taint/toleration 上启用自动 pod 重新安排

Kubernetes - Enable automatic pod rescheduling on taint/toleration

在以下情况下:

  1. Pod X 可以容忍污点
  2. 然而,具有这种污点的节点 A 并不存在
  3. Pod X 同时被安排在不同的节点 B 上
  4. 具有适当污点的节点 A 变为就绪

这里,Kubernetes 不会触发节点 A 上的 pod X 的自动重新调度,因为它在节点 B 上 运行 是正确的。有没有办法启用到节点 A 的自动重新调度?

本地,可能不是,除非你:

  • nodeB 的污点更改为 NoExecute(可能已经设置):

NoExecute - the pod will be evicted from the node (if it is already running on the node), and will not be scheduled onto the node (if it is not yet running on the node).

即:

You can put multiple taints on the same node and multiple tolerations on the same pod.

The way Kubernetes processes multiple taints and tolerations is like a filter: start with all of a node’s taints, then ignore the ones for which the pod has a matching toleration; the remaining un-ignored taints have the indicated effects on the pod. In particular,

if there is at least one un-ignored taint with effect NoSchedule then Kubernetes will not schedule the pod onto that node

如果那不可能,那么使用 Node Affinity 可能会有所帮助(但这与污点不同)