Recreating kubelet sandbox false when reboot cluster server using kubeadm

北城以北 提交于 2020-04-17 23:33:07

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/60294047/recreating-kubelet-sandbox-false-when-reboot-cluster-server-using-kubeadm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!