Remove node-role.kubernetes.io/master:NoSchedule taint
Asked Answered
R

4

18

What CLI command can I type to remove the node-role.kubernetes.io/master:NoSchedule taint from the master node in a Kubernetes cluster?

The following command is failing:

[lnxcfg@ip-10-0-0-193 ~]$ kubectl taint nodes $(kubectl get nodes --selector=node-role.kubernetes.io/master | awk 'FNR==2{print $1}') key:node-role.kubernetes.io/master:NoSchedule-
error: invalid taint effect: node-role.kubernetes.io/master, unsupported taint effect

As you can see below, I am able to get the name of the master node successfully by using the following command, which is also embedded in the above failing command:

[lnxcfg@ip-10-0-0-193 ~]$ kubectl get nodes --selector=node-role.kubernetes.io/master | awk 'FNR==2{print $1}'
ip-10-0-0-193.us-west-2.compute.internal

This is an AWS Linux 2 node hosting the master node of a single master Kubernetes cluster.

Roderic answered 15/3, 2019 at 23:41 Comment(0)
C
30
kubectl taint nodes $(hostname) node-role.kubernetes.io/master:NoSchedule-

But you can also schedule on master node without removing the taint:

apiVersion: extensions/v1beta1
kind: Deployment
...
  spec:
...
    spec:
...
      tolerations:
        - key: "node-role.kubernetes.io/master"
          effect: "NoSchedule"
          operator: "Exists"
Calvary answered 16/3, 2019 at 0:24 Comment(0)
D
10

Below command can be used to remove taint from node.

kubectl taint nodes controlplane node-role.kubernetes.io/master:NoSchedule- 
Diversify answered 3/6, 2021 at 4:55 Comment(0)
C
8

you can edit node configuration and comment the taint part.

kubectl edit node <node_name>

once you comment the taint json and exit. It would update the node.

Contortionist answered 5/9, 2019 at 6:33 Comment(0)
S
0

as per documentation https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#taint

this should work.

kubectl taint nodes $(kubectl get nodes --selector=node-role.kubernetes.io/master | awk 'FNR==2{print $1}') node-role.kubernetes.io/master-
Scandinavia answered 9/3, 2020 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.