Taint nodes¶
Taint is one means to exclude one or mode nodes from installing containers. The full documentation is here:
https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
We give here some basic examples on how to taint, untaint and get list of taints on our k8s nodes.
Get list of nodes¶
Issue the following commmand:
kubectl get nodes
Taint node¶
Issue the following commmand:
kubectl taint nodes nodename dedicated=everybody:NoSchedule
where “everybody” is a non-existent group name.
Untaint node¶
Issue the following command:
kubectl taint nodes nodename dedicated-
The output of the command will be something like:
node/nodename tainted
Get list of taints¶
Either do:
kubectl describe nodes| grep -e Name: -e Taints:
or prepare the following template nodes-taints.tmpl:
{{printf "%-50s %-12s\n" "Node" "Taint"}}
{{- range .items}}
{{- if $taint := (index .spec "taints") }}
{{- .metadata.name }}{{ "\t" }}
{{- range $taint }}
{{- .key }}={{ .value }}:{{ .effect }}{{ "\t" }}
{{- end }}
{{- "\n" }}
{{- end}}
{{- end}}
Then execute the command:
kubectl get nodes -o go-template-file="./nodes-taints.tmpl"