欢迎光临
我们一直在努力

重启服务器后k8s集群coredns组件状态为CrashLoopBackOff

在服务完成阶段性部署,coredns内存溢出问题解决后,仍然存在状态异常。

[root@lolicp ~]# kubectl get pod -o wide --all-namespaces
NAMESPACE            NAME                                      READY   STATUS             RESTARTS   AGE   IP                NODE    NOMINATED NODE   READINESS GATES
kube-system          coredns-876c489b-trq55                    0/1     CrashLoopBackOff   7          24m   10.244.1.61       node2   
kube-system          coredns-876c489b-xsb4d                    0/1     CrashLoopBackOff   6          23m   10.244.0.67       node1   
[root@lolicp ~]# kubectl describe pod -n kube-system  coredns-876c489b-xsb4d
  Warning  FailedCreatePodSandBox  3m43s                  kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "212b1d942b7081a9a10e5119a5f407b819f6d1d6f2cf5e4d38f90d5f913c3fbf" network for pod "coredns-876c489b-xsb4d": networkPlugin cni failed to set up pod "coredns-876c489b-xsb4d_kube-system" network: open /run/flannel/subnet.env: no such file or directory
  Normal   SandboxChanged          3m37s (x12 over 4m2s)  kubelet            Pod sandbox changed, it will be killed and re-created.
  Normal   Pulled                  3m36s                  kubelet            Container image "lolicp:8424/coredns/coredns:v1.8.0" already present on machine
  Normal   Created                 3m36s                  kubelet            Created container coredns
  Warning  FailedCreatePodSandBox  3m20s (x2 over 3m24s)  kubelet            (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "663d2c007b193113f81bc9ea5f90e325326c50424466b0b9c969a942aa6a90c3" network for pod "coredns-876c489b-xsb4d": networkPlugin cni failed to set up pod "coredns-876c489b-xsb4d_kube-system" network: open /run/flannel/subnet.env: no such file or directory

解决办法

重启flannel组件服务
[root@lolicp ~]# kubectl get pod -o wide -n kube-system -l app=flannel|awk 'NR>1 {print $1}'|xargs -i kubectl delete pod -n kube-system {}
重启coredns组件服务
[root@lolicp ~]# kubectl get deploy -n kube-system -o wide
NAME             READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS       IMAGES                                                           SELECTOR
coredns          0/2     2            0           21h   coredns          lolicp:8424/coredns/coredns:v1.8.0                            k8s-app=kube-dns
[root@lolicp ~]# kubectl get pod -o wide -n kube-system -l k8s-app=kube-dns|awk 'NR>1 {print $1}'|xargs -i kubectl delete pod -n kube-system {}
验证
[root@hxb-node1 ~]# kubectl get pod -o wide -n kube-system
NAME                              READY   STATUS    RESTARTS   AGE     IP                NODE    NOMINATED NODE   READINESS GATES
coredns-876c489b-2htwk            1/1     Running   1          3m52s   10.244.1.62       node2   
coredns-876c489b-lft4f            1/1     Running   1          3m44s   10.244.0.68       node1   

文章来源于互联网:重启服务器后k8s集群coredns组件状态为CrashLoopBackOff

赞(0)
未经允许不得转载:莱卡云 » 重启服务器后k8s集群coredns组件状态为CrashLoopBackOff