【问题标题】:Coredns in pending state in Kubernetes cluster v1.19.4Kubernetes 集群 v1.19.4 中处于挂起状态的 Coredns
【发布时间】:2021-03-09 14:34:26
【问题描述】:

在完成所有配置并初始化集群后,我正在尝试配置一个具有 1 个 master 和 2 个 worker 的 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

我尝试遵循此解决方案,但它对我不起作用

Coredns in pending state in Kubernetes cluster

有人有进一步的建议吗?

同时status kubelet的输出

【问题讨论】:

标签: kubernetes kubectl kubeadm


【解决方案1】:

您应该使用网络 CNI 来增强您的集群,例如 Kubernetes 官方支持的 Calico

第一次使用正确的kubeadm init 运行pod-network-cidr

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

成功部署 calico pod 后,CoreDNS 将自动启动。

然后您可以使用kubeadm join 命令将节点添加到集群中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-01
    • 2021-10-07
    • 2019-07-19
    • 2023-03-09
    • 2018-12-25
    相关资源
    最近更新 更多