Kubernetes 设置master相关

设置master调度命令

1.设置master一般情况下不接受pod调度
sudo kubectl taint nodes master node-role.kubernetes.io/master=true:NoSchedule
2.master运行pod
kubectl taint nodes master node-role.kubernetes.io/master-
3.master不运行pod
kubectl taint nodes master node-role.kubernetes.io/master=:NoSchedule

4.查看master表示不运行pod

yang@master:~$ kubectl describe node master |grep Taints
Taints: node-role.kubernetes.io/master=true:NoSchedule

5.查看master表示运行pod

yang@master:~$ kubectl describe node master |grep Taints
Taints: <none>
6.查看master node 的name 和roles
kubectl describe node node1
7.去掉master的roles worker
yang@master:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready control-plane,master,worker 2d22h v1.22.10
node Ready worker 2d21h v1.22.10
yang@master:~$ sudo kubectl label node master node-role.kubernetes.io/worker-
node/master labeled
yang@master:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready control-plane,master 2d22h v1.22.10
node Ready worker 2d21h v1.22.10
8.查看api-server服务 的类型
sudo kubectl -n kubesphere-system get svc
9.将 ks-apiserver 的服务类型变更为 NodePort
sudo kubectl -n kubesphere-system patch service ks-apiserver -p '{"spec":{"type":"NodePort"}}'

  

 

 

posted @ 2022-10-28 15:21  西瓜君~  阅读(202)  评论(0编辑  收藏  举报