Kubernetes: Remove taint from node

2 min read | by Jordi Prats

With a taint on a node we can repel Pods as we saw on the post regarding taints and tolerations. So, if we want to taint a node we use kubectl taint as follows:

$ kubectl taint nodes minikube application=example:NoSchedule
node/minikube tainted

How do we untaint a node?

We can use kubectl taint but adding an hyphen at the end to remove the taint (untaint the node):

$ kubectl taint nodes minikube application=example:NoSchedule-
node/minikubee untainted

If we don't know the command used to taint the node we can use kubectl describe node to get the exact taint we'll need to use to untaint the node:

$ kubectl describe node minikube
Name:               minikube
Roles:              control-plane,master
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=minikube
                    kubernetes.io/os=linux
                    minikube.k8s.io/commit=a03fbcf166e6f74ef224d4a63be4277d017bb62e
                    minikube.k8s.io/name=minikube
                    minikube.k8s.io/updated_at=2021_09_02T15_54_26_0700
                    minikube.k8s.io/version=v1.22.0
                    node-role.kubernetes.io/control-plane=
                    node-role.kubernetes.io/master=
                    node.kubernetes.io/exclude-from-external-load-balancers=
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Thu, 02 Sep 2021 15:53:58 +0200
Taints:             group=ampa:NoSchedule
Unschedulable:      false
(...)

Based on the taint we see the command we need to use to remove it is:

$ kubectl taint nodes minikube group=ampa:NoSchedule-
node/minikube untainted

Posted on 13/09/2021

Categories