设置污点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# 设置为一定不能被调度
[root@k8s-master01 ~]# kubectl taint node k8s-master01 node-role.kubernetes.io/master="":NoSchedule
node/k8s-master01 tainted
[root@k8s-master01 ~]# kubectl taint node k8s-master02 node-role.kubernetes.io/master="":NoSchedule
node/k8s-master02 tainted
[root@k8s-master01 ~]# kubectl taint node k8s-master03 node-role.kubernetes.io/master="":NoSchedule
node/k8s-master03 tainted
[root@k8s-master01 ~]#
# 查看污点
[root@k8s-master01 ~]# kubectl describe node | grep Ta
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: node-role.kubernetes.io/master:NoSchedule
Taints: <none>
Taints: <none>
Taints: <none>
Taints: <none>
Taints: <none>
[root@k8s-master01 ~]#
|
设置污点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# 设置为不仅不会调度, 还会驱逐Node上已有的Pod
[root@k8s-master01 ~]# kubectl taint node k8s-master03 node-role.kubernetes.io/master="":NoExecute
node/k8s-master03 tainted
[root@k8s-master01 ~]# kubectl taint node k8s-master02 node-role.kubernetes.io/master="":NoExecute
node/k8s-master02 tainted
[root@k8s-master01 ~]# kubectl taint node k8s-master01 node-role.kubernetes.io/master="":NoExecute
node/k8s-master01 tainted
# 查看污点
[root@k8s-master01 ~]# kubectl describe node | grep Ta
Taints: node-role.kubernetes.io/master:NoExecute
Taints: node-role.kubernetes.io/master:NoExecute
Taints: node-role.kubernetes.io/master:NoExecute
Taints: <none>
Taints: <none>
Taints: <none>
Taints: <none>
Taints: <none>
[root@k8s-master01 ~]#
|
参考文档:
https://developer.aliyun.com/article/950742