在完成所有配置并初始化集群后,我正在尝试配置一个具有1个主节点和2个工作节点的kubernetes集群。我在coredns 上一直处于挂起状态
kube-system coredns-f9fd979d6-7c7fp 0/1 Pending 0 26h <none> <none> <none> <none>
kube-system coredns-f9fd979d6-xpf6d 0/1 Pending 0 26h <none> <none> <none> <none>
kube-system etcd-l00301c002075 1/1 Running 0 26h 10.87.22.132 l00301c002075 <none> <none>
kube-system kube-apiserver-l00301c002075 1/1 Running 0 26h 10.87.22.132 l00301c002075 <none> <none>
kube-system kube-controller-manager-l00301c002075 1/1 Running 1 26h 10.87.22.132 l00301c002075 <none> <none>
kube-system kube-proxy-mrzbx 1/1 Running 0 26h 10.87.22.132 l00301c002075 <none> <none>
kube-system kube-scheduler-l00301c002075 1/1 Running 1 26h 10.87.22.132 l00301c002075 <none> <none>
这里是kubelet状态的输出
L00301C002075 kubelet[3996]: W1126 16:10:01.023901 3996 cni.go:239] Unable to update cni config: no networks found in /etc/cni/net.d
Nov 26 16:10:03 L00301C002075 kubelet[3996]: E1126 16:10:03.242440 3996 kubelet.go:2103] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Nov 26 16:10:06 L00301C002075 kubelet[3996]: W1126 16:10:06.024105 3996 cni.go:239] Unable to update cni config: no networks found in /etc/cni/net.d
Nov 26 16:10:08 L00301C002075 kubelet[3996]: E1126 16:10:08.243924 3996 kubelet.go:2103] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Nov 26 16:10:11 L00301C002075 kubelet[3996]: W1126 16:10:11.024305 3996 cni.go:239] Unable to update cni config: no networks found in /etc/cni/net.d
Nov 26 16:10:13 L00301C002075 kubelet[3996]: E1126 16:10:13.245176 3996 kubelet.go:2103] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Nov 26 16:10:16 L00301C002075 kubelet[3996]: W1126 16:10:16.024604 3996 cni.go:239] Unable to update cni config: no networks found in /etc/cni/net.d
Nov 26 16:10:18 L00301C002075 kubelet[3996]: E1126 16:10:18.246664 3996 kubelet.go:2103] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Nov 26 16:10:21 L00301C002075 kubelet[3996]: W1126 16:10:21.024786 3996 cni.go:239] Unable to update cni config: no networks found in /etc/cni/net.d
Nov 26 16:10:23 L00301C002075 kubelet[3996]: E1126 16:10:23.248173 3996 kubelet.go:2103] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
我试着遵循这个解决方案,但它对我不起作用
Kubernetes集群中处于挂起状态的Coredns
有人有进一步的建议吗?
而状态kubelet 的输出
您应该使用Network CNI来增强集群,例如Kubernetes正式支持的Calico。
使用正确的pod-network-cidr
:首次运行kubeadm init
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --<additional-flags>
部署集群后,运行以下命令:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
完成后,您可以安装Calico:
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
当花布吊舱成功部署时,CoreDNS
将自动启动。
然后可以使用kubeadm join
命令将节点添加到集群中。