kubernetes: 修改node 角色
新安装的kubernetes环境有时候node节点的 roles会缺失,我们可以手动添加上去
root@k8s-master:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 50d v1.16.7
k8s-node1 NotReady <none> 50d v1.16.7
k8s-node2 NotReady <none> 50d v1.16.7
我们只需要给对应的节点打上合适的标签即可
kubectl label node k8s-node1 node-role.kubernetes.io/worker=worker
root@k8s-master:~# kubectl label node k8s-node1 node-role.kubernetes.io/worker=worker
node/k8s-node1 labeled
root@k8s-master:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 50d v1.16.7
k8s-node1 NotReady worker 50d v1.16.7
k8s-node2 NotReady <none> 50d v1.16.7
root@k8s-master:~#
删除标签操作
kubectl label nodes k8s-node1 node-role.kubernetes.io/worker-
[root@k8s-master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-node1 Ready <none> 37d v1.18.3
k8s-node2 Ready worker 37d v1.18.3