Taints and tolerations in Kubernetes

<p><strong>Node affinity</strong>&nbsp;is a property of Pods that attracts them to a set of nodes.&nbsp;<strong>Taints</strong>&nbsp;are the opposite &mdash; they allow a node to repel a set of pods.&nbsp;<strong>Tolerations</strong>&nbsp;are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints.</p> <h1>1) Create a taint on&nbsp;<code>node01</code>&nbsp;with key of&nbsp;<code>spray</code>, value of&nbsp;<code>mortein</code>&nbsp;and effect of&nbsp;<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: &lt;none&gt; 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: &lt;none&gt; 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&nbsp;<code>bee</code>&nbsp;with the&nbsp;<code>nginx</code>&nbsp;image, which has a toleration set to the taint&nbsp;<code>mortein</code>.</h1> <p><a href="https://medium.com/@harishpillai1994/taints-and-tolerations-in-kubernetes-e9e63323f228"><strong>Visit Now</strong></a></p>