Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between NoExecute, NoSchedule, PreferNoSchedule?

Tags:

kubernetes

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

like image 928
Chris Stryczynski Avatar asked Jun 21 '18 10:06

Chris Stryczynski


People also ask

What are taints and Tolerations?

Node affinity is a property of Pods that attracts them to a set of nodes (either as a preference or a hard requirement). Taints are the opposite -- they allow a node to repel a set of pods. Tolerations are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints.

What is difference between node affinity and pod affinity?

The affinity feature consists of two types of affinity: Node affinity functions like the nodeSelector field but is more expressive and allows you to specify soft rules. Inter-pod affinity/anti-affinity allows you to constrain Pods against labels on other Pods.

What is the difference between node selector and node affinity?

Node affinity enables a conditional approach with logical operators in the matching process, while nodeSelector is limited to looking for exact label key-value pair matches. Node affinity is specified in the PodSpec using the nodeAffinity field in the affinity section.

How do you tolerate all taints?

Tolerating all taints You can configure a pod to tolerate all taints by adding an operator: "Exists" toleration with no key and value parameters. Pods with this toleration are not removed from a node that has taints.


1 Answers

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.

like image 167
suren Avatar answered Nov 08 '22 07:11

suren