What is the difference between NoExecute, NoSchedule, PreferNoSchedule?

6/21/2018

https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ The docs are not very clear as to what exactly the values represent.

the system will try to avoid placing a pod that does not tolerate the taint on the node, but it is not required

What does 'try' imply? If I said a function will try sort a a list of numbers - it's not very clear...

-- Chris Stryczynski
kubernetes

2 Answers

6/21/2018

Based on your question - which I understand it is regarding PreferNoSchedule - It means that it is not a strict requirement, in other words, if a pod is already scheduled on that node and it has that toleration effect, it won't be removed.

I would suggest you to dive into the design proposals docs if you are still confused, they clarified a lot of concepts for me.

-- iomv
Source: StackOverflow

6/21/2018

Although there is a slight difference, I like more Google explanation about what Node Taints are, rather then Kubernetes:

A node taint lets you mark a node so that the scheduler avoids or prevents using it for certain Pods. A complementary feature, tolerations, lets you designate Pods that can be used on "tainted" nodes.

Node taints are key-value pairs associated with an effect. Here are the available effects:

NoSchedule: Pods that do not tolerate this taint are not scheduled on the node.

PreferNoSchedule: Kubernetes avoids scheduling Pods that do not tolerate this taint onto the node. This one basically means, do it, if possible.

NoExecute: Pod is evicted from the node if it is already running on the node, and is not scheduled onto the node if it is not yet running on the node.

Note that the difference between NoSchedule and NoExecute is that with the first one it won't schedule a pod, but if it is already running, it won't kill it. With the last one, it will kill the pod and re-schedule on another node.

-- suren
Source: StackOverflow