OpenShift- Taint & Tolerations
1 min readJan 20, 2024
In OpenShift, taints and tolerations are mechanisms used to influence the scheduling of pods onto nodes within a cluster. They help control how pods are placed on nodes based on specific criteria.
Taints:
What is a Taint?
- A taint is a property applied to a node that repels certain pods.
- It represents a condition on a node that may affect whether a pod is scheduled on that node.
Example Taint:
- A node may be tainted to indicate that it shouldn’t accept workloads unless they have a specific toleration.
$ oc adm taint nodes <node-name> key=value:effect
--> <node-name> is the name of the node.
--> key=value is the taint key-value pair.
--> effect can be "NoSchedule" (default), "PreferNoSchedule," or "NoExecute."
Tolerations:
What is a Toleration?
- A toleration is a pod specification that allows a pod to be scheduled onto a node with a matching taint.
- It essentially tells the scheduler that the pod can tolerate nodes with specific taints.
Example Toleration in Pod YAML:
tolerations:
- key: "key"
operator: "Equal"
value: "value"
effect: "NoSchedule"
**
This toleration means the pod tolerates nodes with a taint of key "key," value "value," and effect "NoSchedule."