KubernetesKubernetes

安装Kubernetes报错:STATUS NotReady

2019-03-21  本文已影响0人  王勇1024

执行kubeadm init命令后,想看一下所有节点的运行状态,结果发现所有节点始终处于NotReady状态

$ sudo kubectl get nodes
NAME         STATUS     ROLES    AGE    VERSION
kube-node1   NotReady   master   174m   v1.13.3
kube-node2   NotReady   <none>   168m   v1.13.4
kube-node3   NotReady   <none>   167m   v1.13.3

查看错误日志

$ sudo journalctl -f -u kubelet

-- Logs begin at 日 2019-03-17 14:18:29 CST. --
3月 21 22:31:50 kube-node1 kubelet[167130]: E0321 22:31:50.136580  167130 summary_sys_containers.go:47] Failed to get system container stats for "/system.slice/docker.service": failed to get cgroup stats for "/system.slice/docker.service": failed to get container info for "/system.slice/docker.service": unknown container "/system.slice/docker.service"
3月 21 22:31:50 kube-node1 kubelet[167130]: E0321 22:31:50.137336  167130 summary_sys_containers.go:47] Failed to get system container stats for "/system.slice/kubelet.service": failed to get cgroup stats for "/system.slice/kubelet.service": failed to get container info for "/system.slice/kubelet.service": unknown container "/system.slice/kubelet.service"
3月 21 22:31:53 kube-node1 kubelet[167130]: W0321 22:31:53.529945  167130 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
3月 21 22:31:53 kube-node1 kubelet[167130]: E0321 22:31:53.530035  167130 kubelet.go:2192] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
3月 21 22:31:58 kube-node1 kubelet[167130]: W0321 22:31:58.530693  167130 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
3月 21 22:31:58 kube-node1 kubelet[167130]: E0321 22:31:58.530794  167130 kubelet.go:2192] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
3月 21 22:32:00 kube-node1 kubelet[167130]: E0321 22:32:00.145152  167130 summary_sys_containers.go:47] Failed to get system container stats for "/system.slice/kubelet.service": failed to get cgroup stats for "/system.slice/kubelet.service": failed to get container info for "/system.slice/kubelet.service": unknown container "/system.slice/kubelet.service"

从 No networks found in /etc/cni/net.d 这行错误信息来看,猜想大概是网络配置问题,有可能是安装Flannel的过程有问题。

安装Flannel

sysctl net.bridge.bridge-nf-call-iptables=1
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# 修改docker镜像地址
sed 's/quay.io\/coreos/registry.cn-beijing.aliyuncs.com\/imcto/g'
# 安装flannel
sudo kubectl apply -f kube-flannel.yml

再次查看节点状态

$ sudo kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
kube-node1   Ready    master   3h57m   v1.13.3
kube-node2   Ready    <none>   3h51m   v1.13.4
kube-node3   Ready    <none>   3h50m   v1.13.3

参考资料

k8s 集群部署问题整理
Kubernetes使用中发现的问题和错误

上一篇下一篇

猜你喜欢

热点阅读