Viewing Taints on Kubernetes Nodes
To view the taints applied to a Kubernetes node, you can use the kubectl get nodes
command with the -o wide
option. This will display the taints along with other node information.
Here's an example:
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
node1 Ready v1.22.0 10.0.0.4 22.04 LTS 5.15.0-46-generic containerd://1.6.6 < none > 5d < none > Ubuntu
node2 Ready v1.22.0 10.0.0.5 22.04 LTS 5.15.0-46-generic containerd://1.6.6 < none > 5d < none > Ubuntu
In this example, no taints have been applied to the nodes.
To view the taints in a more readable format, you can use the kubectl describe node
command:
$ kubectl describe node node1
Name: node1
Roles: <none>
...
Taints: gpu=true:NoSchedule
Here, we can see that the node node1
has a taint with the key gpu
, a value of true
, and the NoSchedule
effect.
You can also use the kubectl get nodes --show-labels
command to view the taints as part of the node labels:
$ kubectl get nodes --show-labels
NAME STATUS ROLES AGE VERSION LABELS
node1 Ready v1.22.0 kubernetes.io/arch=amd64,kubernetes.io/os=linux,node-role.kubernetes.io/worker=true,node.kubernetes.io/taint-effect=NoSchedule,node.kubernetes.io/taint-key=gpu,node.kubernetes.io/taint-value=true < none > 5d
node2 Ready v1.22.0 kubernetes.io/arch=amd64,kubernetes.io/os=linux,node-role.kubernetes.io/worker=true < none > 5d
In this output, we can see the taint applied to node1
as part of the node labels.