Kubernetes - Enable automatic pod rescheduling on taint/toleration

4/29/2019

In the following scenario:

  1. Pod X has a toleration for a taint
  2. However node A with such taint does not exists
  3. Pod X get scheduled on a different node B in the meantime
  4. Node A with the proper taint becomes Ready

Here, Kubernetes does not trigger an automatic rescheduling of the pod X on node A as it is properly running on node B. Is there a way to enable that automatic rescheduling to node A?

-- Arkon
kubernetes
kubernetes-pod

1 Answer

4/29/2019

Natively, probably not, unless you:

  • change the taint of nodeB to NoExecute (it probably already was set) :

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).

That is:

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

If that is not possible, then using Node Affinity could help (but that differs from taints)

-- VonC
Source: StackOverflow