kubernetes修改node的role标签

执行kubectl get node命令,可以看到如下结果:

[root@APP-SERVER-75 ~]# kubectl get node
NAME            STATUS   ROLES    AGE   VERSION
app-server-75   Ready    master   18h   v1.16.3
app-server-76   Ready    master   18h   v1.16.3
app-server-77   Ready    <none>   17h   v1.16.3
app-server-78   Ready    <none>   17h   v1.16.3
app-server-86   Ready    <none>   17h   v1.16.3
app-server-87   Ready    <none>   17h   v1.16.3
app-server-88   Ready    <none>   17h   v1.16.3

再执行:kubectl describe node node1

Name:               app-server-75
Roles:              master
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=app-server-75
                    kubernetes.io/os=linux
                    node-role.kubernetes.io/master=
Annotations:        flannel.alpha.coreos.com/backend-data: {"VtepMAC":"26:bd:ce:f0:93:41"}
                    flannel.alpha.coreos.com/backend-type: vxlan
                    flannel.alpha.coreos.com/kube-subnet-manager: true
                    flannel.alpha.coreos.com/public-ip: 192.9.202.75
                    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:  Mon, 02 Dec 2019 15:36:44 +0800

需要将node标签加回去,则要执行:

kubectl label nodes  node1 node-role.kubernetes.io/node=

需要将node标签删除,则要执行:

kubectl label nodes  node1 node-role.kubernetes.io/node-