Taints and tolerations in Kubernetes
<p><strong>Node affinity</strong> is a property of Pods that attracts them to a set of nodes. <strong>Taints</strong> are the opposite — they allow a node to repel a set of pods. <strong>Tolerations</strong> are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints.</p>
<h1>1) Create a taint on <code>node01</code> with key of <code>spray</code>, value of <code>mortein</code> and effect of <code>NoSchedule</code></h1>
<pre>
controlplane ~ ➜ kubectl describe nodes node01 | grep -i tain
kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/containerd/containerd.sock
Taints: <none>
Container Runtime Version: containerd://1.6.6
controlplane ~ ➜ kubectl describe nodes node01 | grep -in tain
12: kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/containerd/containerd.sock
16:Taints: <none>
55: Container Runtime Version: containerd://1.6.6
controlplane ~ ➜ kubectl taint nodes node01 spray=mortein:NoSchedule
node/node01 tainted
controlplane ~ ➜ kubectl describe nodes node01 | grep -in tain
12: kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/containerd/containerd.sock
16:Taints: spray=mortein:NoSchedule
55: Container Runtime Version: containerd://1.6.6</pre>
<h1>2) Create another pod named <code>bee</code> with the <code>nginx</code> image, which has a toleration set to the taint <code>mortein</code>.</h1>
<p><a href="https://medium.com/@harishpillai1994/taints-and-tolerations-in-kubernetes-e9e63323f228"><strong>Visit Now</strong></a></p>