What is meaning of taint?
a trace of a bad or undesirable substance or quality.
What is tainted?
spoiled; damaged in quality, taste, or value.
What is toleration?
the practice of tolerating something, in particular differences of opinion or behaviour.
Here in Kubernetes, we use taint with nodes and Tolerations with Pod.
- 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 – Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints.
Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. One or more taints are applied to a node; this marks that the node should not accept any pods that do not tolerate the taints.
Lets understand using taint with one or more nodes in Kubernetes first.
The default value for operator is Equal.
A toleration “matches” a taint if the keys are the same and the effects are the same, and:
- the operator is Exists (in which case no value should be specified), or
- the operator is Equal and the values are equal.
Here’s an example of a pod that uses tolerations: