In k8s how to setup to demo `kubectl taint nodes --all node-role.kubernetes.io/master-`?

9/5/2019

To untaint my nodes, my scripts use ...

# kubectl taint nodes --all node-role.kubernetes.io/master-

but I want to deliberately taint my node to test this untaint functionality. I tried this variant and it works fine ...

# kubectl taint nodes foo foo=DoNotSchedulePods:NoExecute 
# kubectl taint nodes foo foo:NoExecute-   
node/foo untainted

but I can't see how to set up so I can test the specific taint that I need to get rid of. I tried e.g.

# kubectl taint nodes foo foo=node-role.kubernetes.io/master     
error: unknown taint spec: foo=node-role.kubernetes.io/master  

How to put it into situation where I can test the aforementioned untainted command?

-- k1eran
kubernetes

1 Answer

9/5/2019

To untaint the node:

 kubectl taint node <Node Name> node-role.kubernetes.io/master-

To taint the node:

 kubectl taint node <Node Name> node-role.kubernetes.io/master=:NoSchedule
-- Subramanian Manickam
Source: StackOverflow