$ kubectl taint --help



Update the taints on one or more nodes.



* A taint consists of a key, value, and effect. As an argument here, it is expressed as key=value:effect.



* The key must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to



253 characters.



* Optionally, the key can begin with a DNS subdomain prefix and a single '/', like example.com/my-app



* The value must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up



to 63 characters.



* The effect must be NoSchedule, PreferNoSchedule or NoExecute.



* Currently taint can only apply to node.



Examples:



# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'.



# If a taint with that key and effect already exists, its value is replaced as specified.



kubectl taint nodes foo dedicated=special-user:NoSchedule



# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists.



kubectl taint nodes foo dedicated:NoSchedule-



# Remove from node 'foo' all the taints with key 'dedicated'



kubectl taint nodes foo dedicated-





# Add a taint with key 'dedicated' on nodes having label mylabel=X



kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule



Options:



--all=false: Select all nodes in the cluster



--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in



the template. Only applies to golang and jsonpath output formats.



--include-extended-apis=true: If true, include definitions of new APIs via calls to the API server. [default true]



--no-headers=false: When using the default or custom-column output format, don't print headers (default print



headers).



-o, --output='': Output format. One of:



json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...



See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template



[http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template



[http://kubernetes.io/docs/user-guide/jsonpath].



--overwrite=false: If true, allow taints to be overwritten, otherwise reject taint updates that overwrite existing



taints.



-l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)



-a, --show-all=false: When printing, show all resources (default hide terminated pods.)



--show-labels=false: When printing, show all labels as the last column (default hide labels column)



--sort-by='': If non-empty, sort list types using this field specification. The field specification is expressed



as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression



must be an integer or a string.



--template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The



template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].



--validate=true: If true, use a schema to validate the input before sending it



Usage:



kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]



Use "kubectl options" for a list of global command-line options (applies to all commands).

Let’s demo.

Here we have a kubernetes cluster running 1 x Master and 2 x Worker Nodes.