k8s单节点无法启动pod

错误信息: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
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值