k8s单节点无法启动pod
k8s单节点无法启动pod错误信息:pod didn't tolerate原因:默认 k8s 不允许往 master 节点装东西,强行设置下允许解决方案:如下(参考[k8s 1.12.1 的坑和解决方法](https://segmentfault.com/a/1190000017010166))错误信息:NetworkPluginNotReady message:docker: network p
·
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
更多推荐
已为社区贡献3条内容
所有评论(0)