一.简单说明
这里我们部署的Kubernetes集群,master节点默认是unscheduled的状态,也就是默认拒绝将Pod调度到master节点运行。专业术语就是:Master节点被赋予了一个或者多个"污点","污点"的作用是让该节点拒绝将Pod调度运行在其上。这种情况下,我们如果想让master节点可以调度pod运行如何实现,这里有两种方案:
- 去掉污点(taints)
- 让pod能够容器(tolerations)该节点上的污点。
1.1 方案一:去掉污点
- 查看节点调度情况
[root@k8s001 ~]# kubectl get node
NAME STATUS ROLES AGE VERSION
172.16.33.22 Ready master 3d v1.13.5
172.16.33.23 Ready node 3d v1.13.5
172.16.33.24 Ready node 3d v1.13.5
[root@k8s001 ~]# kubectl describe node 172.16.33.22
......
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal NodeNotSchedulable 11s (x2 over 3d) kubelet, 172.16.33.22 Node 172.16.33.22 status is now: NodeNotSchedulable
......
- 去除污点
[root@k8s001 ~]# kubectl uncordon 172.16.33.22
1.2 方案二:增加污点容忍
[root@k8s001 ~]# cat pod.yaml
......
spec:
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: nginx-pod
......