首页 > 其他分享 >k8s集群角色管理

k8s集群角色管理

时间:2023-02-11 11:22:07浏览次数:46  
标签:node kubectl 角色 v1.23 master 集群 nodes k8s

查看集群各节点角色:

复制代码
[root@k8s-master-2 ~]# kubectl get nodes
NAME           STATUS   ROLES                  AGE   VERSION
k8s-master-1   Ready    master                 45d   v1.23.2
k8s-master-2   Ready    control-plane,master   57d   v1.23.2
k8s-master-3   Ready    master                 45d   v1.23.2
k8s-node-1     Ready    node                   57d   v1.23.2
k8s-node-2     Ready    node                   45d   v1.23.2
k8s-node-3     Ready    node                   45d   v1.23.2
复制代码

设置角色:

复制代码
# 将k8s-master-1设置为master角色
[root@k8s-master-2 ~]# kubectl label nodes k8s-master-1 node-role.kubernetes.io/master=node/k8s-master-1 labeled
# 将k8s-node-1设置为node角色 [root@k8s-master-2 ~]# kubectl label nodes k8s-node-1 node-role.kubernetes.io/node=node/k8s-node-1 labeled # 将k8s-master-1设置master角色,一般不接受负载
[root@k8s-msater-2 ~] kubectl taint nodes k8s-master-1 node-role.kubernetes.io/master=true:NoSchedule
# 将k8s-mster-1设置master运行pod
[root@k8s-master-2 ~] kubectl taint nodes k8s-master-1 node-role.kubernetes.io/master-
# 将k8s-master-1设置master不运行pod
[root@k8s-master-2 ~] kubectl taint nodes k8s-master-1 node-role.kubernetes.io/master=:NoSchedule
复制代码

标签:node,kubectl,角色,v1.23,master,集群,nodes,k8s
From: https://www.cnblogs.com/ezgod/p/17111094.html

相关文章