给k8s节点打标签
原创小于 1 分钟
给k8s节点打标签
本实践将在 Ubuntu 22.04.3LTS 系统上进行安装测试
docker版本 24.0.6
kubeadm版本v1.28.2
版本
操作步骤
kubectl get nodes -A -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
node-1 Ready control-plane 19d v1.28.2 172.xxx.xxx.x <none> Ubuntu 22.04.3 LTS 5.15.0-84-generic docker://24.0.6
node-2 Ready <none> 56m v1.28.2 172.xxx.xxx.x <none> Ubuntu 18.04.6 LTS 5.4.0-90-generic docker://24.0.2
node-3 Ready <none> 5m19s v1.28.2 172.xxx.xxx.x <none> Ubuntu 20.04.2 LTS 5.8.0-43-generic docker://24.0.6
node-4 Ready control-plane 19d v1.28.2 172.xxx.xxx.x <none> Ubuntu 22.04.3 LTS 5.15.0-84-generic docker://24.0.6
kubectl label nodes node-1 node-role.kubernetes.io/worker=Master
kubectl label nodes node-4 node-role.kubernetes.io/worker=Master
kubectl label nodes node-2 node-role.kubernetes.io/worker=Worker
kubectl label nodes node-3 node-role.kubernetes.io/worker=Worker
kubectl get nodes -A -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
node-1 Ready control-plane,worker 19d v1.28.2 172.xxx.xxx.x <none> Ubuntu 22.04.3 LTS 5.15.0-84-generic docker://24.0.6
node-2 Ready worker 59m v1.28.2 172.xxx.xxx.x <none> Ubuntu 18.04.6 LTS 5.4.0-90-generic docker://24.0.2
node-3 Ready worker 8m40s v1.28.2 172.xxx.xxx.x <none> Ubuntu 20.04.2 LTS 5.8.0-43-generic docker://24.0.6
node-4 Ready control-plane,worker 19d v1.28.2 172.xxx.xxx.x <none> Ubuntu 22.04.3 LTS 5.15.0-84-generic docker://24.0.6