错误信息:pod didn’t tolerate

使用kubectl describe po $pod-name -n $namespace 查询pod信息。($变量根据实际情况替换)错误信息如下

Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  26s   default-scheduler  0/1 nodes are available: 1 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.

原因:默认 k8s 不允许往 master 节点装东西,强行设置下允许

解决方案:如下(参考k8s 1.12.1 的坑和解决方法

kubectl taint nodes --all node-role.kubernetes.io/master-

主节点设置可以启动pod后,发现网络问题,这是个人问题,k8s安装时没有设置网络

错误信息:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

Events:
  Type     Reason            Age                   From               Message
  ----     ------            ----                  ----               -------
  Warning  FailedScheduling  2m34s (x21 over 23m)  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.
  Normal   Scheduled         2m10s                 default-scheduler  Successfully assigned default/busybox-sleep to izbp1545xohbe3qudxjrf9z
  Warning  NetworkNotReady   83s (x25 over 2m10s)  kubelet            network is not ready: container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

原因: 集群没有配置网络

解决方案:设置网络(参考:K8s安装,我的k8s就是按照他安装的)

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

输出为

Warning: policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created

使用kubect get po 发现pod已经启动成功

[root@123 ~]# kubectl get po ;NAME            READY   STATUS    RESTARTS   AGE
busybox-sleep   1/1     Running   0          31m
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐