Node affinity is a property of Pods that attracts them to a set of nodes. Taints are the opposite — they allow a node to repel a set of pods. Tolerations are applied to pods. Tolerations allow the scheduler to schedule pods with matching taints.
1) Create a taint on node01 with key of spray, value of mortein and effect of NoSchedule
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