Taints and Tolerations
Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes.
Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes.
Just like labels , one or more taints can be applied to a node; this marks that the node should not accept any pods that do not tolerate the taints
$ kubectl taint node k8s-master-ah-01 node-role.kubernetes.io/master="":NoSchedule
Format key=value:Effect
NoSchedule
- Pods will not be schedules
PreferNoSchedule
- This is a “preference” or “soft” version of NoSchedule
– the system will try to avoid placing a pod that does not tolerate the taint on the node, but it is not required.
NoExecute
- 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)
Tolerations can be specified on Pods Based on the taints on the nodes , Pods will scheduler will allow to run the Pod on the node.
Toleration syntax in Pod spec.
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule