产生问题的原因是master节点部署Pod,导致无法启动; 问题描述: Warning FailedScheduling 40s (x28 over 28m) default-scheduler 0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn’t tolerate.
部署环境,k8s中的master节点创建Pod
kubectl run 自定义pod名字 --image=基础镜像
示例[root@VM-4-8-centos kubernetes]# kubectl run my-nginx --image=nginx
pod/my-nginx created
namespace
,故默认处于default
中;
命令kubectl get pod
my-nginx一直处于Ping状态;
kubectl describe pod 自定义的Pod名称
原因:kubeadm集群时,出于安全考虑Pod不会被调度到Master Node上,默认情况下,master打了污点,不参与工作负载; 解决方案:手动删除master的污点;
kubectl get no -o yaml | grep taint -A 5
kubectl taint nodes --all node-role.kubernetes.io/master-
结果如下: [root@VM-4-8-centos kubernetes]# kubectl taint nodes --all node-role.kubernetes.io/master-
node/vm-4-8-centos untainted
再次查看Pod状态,已经Running
Events
:QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
//之前Ping事件
Warning FailedScheduling 69s (x36 over 36m) default-scheduler 0/1 nodes are available: 1 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate.
//删除污点之后,执行事件
Normal Pulling 44s kubelet Pulling image "nginx"
Normal Pulled 39s kubelet Successfully pulled image "nginx" in 5.61441699s
Normal Created 39s kubelet Created container my-nginx
Normal Started 38s kubelet Started container my-nginx
kubectl taint nodes k8s node-role.kubernetes.io/master=true:NoSchedule