k8s kubernetes给node节点添加标签和删除node节点标签
时间:2023-03-06 10:54 来源:linux.it.net.cn 作者:IT
[root@k8s-master ~]# hostname #查看节点名称
k8s-master
[root@k8s-master ~]#
[root@k8s-master ~]# kubectl get nodes --show-labels #查看节点标签
NAME STATUS ROLES AGE VERSION LABELS
k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
[root@k8s-master ~]# kubectl label nodes k8s-master env=env #给节点添加一个标签env=env
node/k8s-master labeled
[root@k8s-master ~]# kubectl get nodes --show-labels #再次查看节点标签,确定标签添加上了
NAME STATUS ROLES AGE VERSION LABELS
k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,env=env,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
[root@k8s-master ~]# kubectl label nodes k8s-master env- #删除节点标签env=env
node/k8s-master unlabeled
[root@k8s-master ~]#
[root@k8s-master ~]# kubectl get nodes --show-labels #再次查看确定标签已经删除了
NAME STATUS ROLES AGE VERSION LABELS
k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
[root@k8s-master ~]#
(责任编辑:IT)
[root@k8s-master ~]# hostname #查看节点名称 k8s-master [root@k8s-master ~]# [root@k8s-master ~]# kubectl get nodes --show-labels #查看节点标签 NAME STATUS ROLES AGE VERSION LABELS k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers= [root@k8s-master ~]# kubectl label nodes k8s-master env=env #给节点添加一个标签env=env node/k8s-master labeled [root@k8s-master ~]# kubectl get nodes --show-labels #再次查看节点标签,确定标签添加上了 NAME STATUS ROLES AGE VERSION LABELS k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,env=env,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers= [root@k8s-master ~]# kubectl label nodes k8s-master env- #删除节点标签env=env node/k8s-master unlabeled [root@k8s-master ~]# [root@k8s-master ~]# kubectl get nodes --show-labels #再次查看确定标签已经删除了 NAME STATUS ROLES AGE VERSION LABELS k8s-master Ready control-plane 9d v1.26.0 app=master,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=k8s-master,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers= [root@k8s-master ~]# (责任编辑:IT) |