Basic of Taint & Tolerance with pods in Kubernetes
It's one of the interesting parts of Kubernetes we can say its allocation of resources.
A taint allows a node to refuse pod to be scheduled unless that pod has matching toleration. Taint and tolerance mean communication between node and pod so suppose we have 3 nodes and 4 pods when we try to place the pod in a node on availability it will go in node and get reside but what if we want to apply some rules to the node to allow only selected pod that case called as taint.
Taint means we can apply the rule on the node so not any pod can come and reside in that node so we call it an intolerant node but if we provide privileges to a particular pod then that pod is tolerant to taint as below diagram.
Command to apply taints on node
So we can apply rules on taints along with existing pods definition as well using
NoSchedule — New pods that do not match the taint are not scheduled onto that node but existing pods on the node remain
PreferNoSchedule- New pods that do not match the taint might be scheduled onto that node, but the scheduler tries not to. Existing pods on the node remain
NoExecute — it will allow only tolerant pods in node and kill already intolerant pod from node
Up to now, we did taint but the question is how we can apply toleration to pods? Here we go with below YAML file will tell you,
Conclusion
That’s it! Now your study of advanced Pod scheduling in Kubernetes is complete. Its basic level of introduction tells what is the use of taints and tolerance in future articles we come with labels and selectors of taints and tolerance.