当我重新启动主节点和工作节点时,coredns的pod显示以下错误消息,似乎它在服务器重新启动后无法重新创建kubelet。
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
答案 0 :(得分:2)
您可以尝试清理绒布并重新安装。
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/
删除与绒布相关的接口
ip link
对于每个接口法兰绒,请执行以下操作
ifconfig <name of interface from ip link> down
ip link delete <name of interface from ip link>
安装绒布后
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
要使绒布正常工作,必须将--pod-network-cidr = 10.244.0.0 / 16传递给kubeadm init