简体   繁体   中英

Recreating kubelet sandbox false when reboot cluster server using kubeadm

When I reboot the master and work node, the pod of coredns show the below error message seem that it can not recreate kubelet after server restart.

  Normal   SandboxChanged          12s                   kubelet, izbp1dyjigsfwmw0dtl85gz  Pod sandbox changed, it will be killed and re-created.
  Warning  FailedCreatePodSandBox  11s                   kubelet, izbp1dyjigsfwmw0dtl85gz  Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "5e850ee3e8bf86688fec2badd9b0272127a0d775620a5783e7c30b4e0d412b01" network for pod "coredns-6955765f44-4xnhj": networkPlugin cni failed to set up pod "coredns-6955765f44-4xnhj_kube-system" network: open /run/flannel/subnet.env: no such file or directory

You can try cleaning up flannel and reinstalling it.

kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml

rm -rf /var/lib/cni/
rm -rf /run/flannel
rm -rf /etc/cni/

Remove interfaces related to and flannel:

ip link 

For each interface flannel, do the following

ifconfig <name of interface from ip link> down
ip link delete <name of interface from ip link>

After this install flannel

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml

For flannel to work correctly, you must pass --pod-network-cidr=10.244.0.0/16 to kubeadm init

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM