[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.0app=
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.0app=
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.0app=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 ~]#

技术
今日推荐
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信