kubernetes安装过程中错误(kube-dns 状态一直是Pending,master节点是NotReady)

安装环境如下:

cenos7系统

kubeadm安装方法

版本是:kubernetes1.10

K8s安装完成后,发现所有的pod都起了,除了kube-dns ,显示的状态一直是Pending.如下所示:

[root@worker3 k8s]# kubectl get pods --all-namespaces
NAMESPACE     NAME                              READY     STATUS    RESTARTS   AGE
kube-system   etcd-worker3                      1/1       Running   0          13m
kube-system   kube-apiserver-worker3            1/1       Running   0          13m
kube-system   kube-controller-manager-worker3   1/1       Running   0          13m
kube-system   kube-dns-86f4d74b45-8ptd5         0/3       Pending   0          14m
kube-system   kube-proxy-txfj4                  1/1       Running   0          14m
kube-system   kube-scheduler-worker3            1/1       Running   0          13m

查看 node的状态,如下所示:

[root@worker3 k8s]#  kubectl get node
NAME      STATUS     ROLES     AGE       VERSION
worker3   NotReady   master    14m       v1.10.0

查看日志如下所示:

[root@worker3 k8s]#  journalctl -f -u kubelet.service
-- Logs begin at Mon 2018-09-17 07:17:54 EDT. --
Sep 20 02:03:47 worker3 kubelet[27492]: W0920 02:03:47.950864   27492 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
Sep 20 02:03:47 worker3 kubelet[27492]: E0920 02:03:47.951056   27492 kubelet.go:2125] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Sep 20 02:03:52 worker3 kubelet[27492]: W0920 02:03:52.952334   27492 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
Sep 20 02:03:52 worker3 kubelet[27492]: E0920 02:03:52.952519   27492 kubelet.go:2125] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized

解决的方法:

创建 flannel的pod,,命令如下:

kubectl create -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

等一会儿,发现 pod以及node都正常了。

参考文档

http://www.winseliu.com/blog/2017/08/13/kubeadm-install-k8s-on-centos7-with-resources/

https://tachingchen.com/tw/blog/kubernetes-installation-with-kubeadm/

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(云计算/大数据,Kubernetes)