Using taint stop pod(s) moving to specific node

If you need to stop a pod or pods deploying or moving to a specific node in Kubernetes then the taint function is what you need. Adding a key with a NoSchedule value will ensure that no pod will be able to schedule onto mytestnode unless it has a matching toleration. This useful in a maintenance window for example when you need to reboot a node or replace it.

kubectl taint nodes mytestnode key1=value1:NoSchedule

In conjunction with the NoScedule key you can use the drain node function to remove all pods from a node.

When you are ready to allow pods to schedule on the node you can remove the taint by removing the taint you added previously.

kubectl taint nodes mytestnode key1=value1:NoSchedule-