TL;DR - 重新创建网络
$ ip link set cni0 down
$ brctl delbr cni0
或者,正如@ws_ 在评论中建议的那样 - 删除接口并重新启动 k8s 服务:
ip link set cni0 down && ip link set flannel.1 down
ip link delete cni0 && ip link delete flannel.1
systemctl restart containerd && systemctl restart kubelet
社区解决方案
它是一个known issue
并且有一些解决方案可以解决它。
filipenv的解决方案是:
关于主从:
$ kubeadm reset
$ systemctl stop kubelet
$ systemctl stop docker
$ rm -rf /var/lib/cni/
$ rm -rf /var/lib/kubelet/*
$ rm -rf /etc/cni/
$ ifconfig cni0 down
$ ifconfig flannel.1 down
$ ifconfig docker0 down
您可能需要在该目录上调用 rm 之前手动umount
文件系统/var/lib/kubelet
)之后我再次启动 docker 和 kubelet 并重新启动 kubeadm 进程
aysark:和kubernetes-handbook在一个食谱中Pod stuck in Waiting or ContainerCreating
都推荐
$ ip link set cni0 down
$ brctl delbr cni0
Flannel 的知识库文章中的一些解决方法
Flannel
并且在KB中有一篇文章: PKS Flannel network get out of sync with docker bridge network (cni0)
解决方法 1:
WA1 和你的一样:
bosh ssh -d <deployment_name> worker -c "sudo /var/vcap/bosh/bin/monit stop flanneld"
bosh ssh -d <deployment_name> worker -c "sudo rm /var/vcap/store/docker/docker/network/files/local-kv.db"
bosh ssh -d <deployment_name> worker -c "sudo /var/vcap/bosh/bin/monit restart all"
解决方法 2:
如果 WA1 没有帮助,KB 建议:
bosh ssh -d <deployment_name> worker -c "sudo /var/vcap/bosh/bin/monit stop flanneld"
bosh ssh -d <> worker -c "ifconfig | grep -A 1 flannel"
On a master node get access to etcd using the following KB
On a master node run `etcdctlv2 ls /coreos.com/network/subnets/`
Remove all the worker subnet leases from etcd by running `etcdctlv2 rm /coreos.com/network/subnets/<worker_subnet>;` for each of the worker subnets from point 2 above.
bosh ssh -d <deployment_name> worker -c "sudo /var/vcap/bosh/bin/monit restart flanneld"