kubernetes修改node的role标签

[root@master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready master 19d v1.10.0
node01 Ready node 19d v1.10.0
node02 Ready node 19d v1.10.0

#查看标签
[root@master ~]# kubectl get node --show-labels
NAME STATUS ROLES AGE VERSION LABELS
master Ready master 19d v1.10.0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=master,node-role.kubernetes.io/master=
node01 Ready node 19d v1.10.0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node01,node-role.kubernetes.io/node=
node02 Ready node 19d v1.10.0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=node02,node-role.kubernetes.io/node=

[root@master ~]# kubectl describe node node01
Name: node01
Roles: node
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/hostname=node01
node-role.kubernetes.io/node=node
Annotations: flannel.alpha.coreos.com/backend-data={“VtepMAC”:“2e:3e:18:79:fd:a1”}
flannel.alpha.coreos.com/backend-type=vxlan
flannel.alpha.coreos.com/kube-subnet-manager=true
flannel.alpha.coreos.com/public-ip=192.168.20.112
node.alpha.kubernetes.io/ttl=0
volumes.kubernetes.io/controller-managed-attach-detach=true
#去掉标签
[root@master ~]# kubectl label node node01 node-role.kubernetes.io/node-
node “node01” labeled
[root@master ~]# kubectl label node node02 node-role.kubernetes.io/node-
node “node02” labeled
[root@master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready master 19d v1.10.0
node01 Ready 19d v1.10.0
node02 Ready 19d v1.10.0

#加上标签
[root@master ~]# kubectl label node node01 node-role.kubernetes.io/node=
node “node01” labeled
[root@master ~]# kubectl label node node02 node-role.kubernetes.io/node=
node “node02” labeled
[root@master ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready master 19d v1.10.0
node01 Ready node 19d v1.10.0
node02 Ready node 19d v1.10.0

Logo

开源、云原生的融合云平台

更多推荐