gpt4 book ai didi

amazon-web-services - NetworkPlugin cni 无法设置 pod "xxxxx"网络 : failed to set bridge addr: "cni0" already has an IP address different from10. x.x.x - 错误

转载 作者:行者123 更新时间:2023-12-04 12:10:17 27 4
gpt4 key购买 nike

Kubernetes 启动工作节点虚拟机( AWS )后出现此错误安慰。我正在使用 PKS ( Pivotal Container Service )

network for pod "xxxxx": NetworkPlugin cni failed to set up pod "xxxxx" network: failed to set bridge addr: "cni0" already has an IP address different from 10.x.x.x/xx



我认为 Flannel为集群中的工作人员分配子网租约,该租约在 24 小时后到期 - 和 flannel.1cni0 /24子网不再匹配,这会导致此问题。

我也知道一个解决方法:
bosh ssh -d worker -c "sudo /var/vcap/bosh/bin/monit stop flanneld" 
bosh ssh -d worker -c "sudo rm /var/vcap/store/docker/docker/network/files/local-kv.db"
bosh ssh -d worker -c "sudo /var/vcap/bosh/bin/monit restart all"

但是,是否有任何永久性解决方法?

最佳答案

TL;DR - 重建网络

$ ip link set cni0 down
$ brctl delbr cni0
或者,正如@ws_ 在评论中建议的那样 - 删除接口(interface)并重新启动 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 的解决方案是:

on master and slaves:

$ 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

you may need to manually umount filesystems from /var/lib/kubelet before calling rm on that dir)After doing that I started docker and kubelet back again and restarted the kubeadm process


aysark:kubernetes-handbook Pod stuck in Waiting or ContainerCreating 的食谱中都推荐
$ ip link set cni0 down
$ brctl delbr cni0
Flannel 的知识库文章中的一些解决方法
还有一篇文章在 Flannel的知识库: PKS Flannel network gets 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"

关于amazon-web-services - NetworkPlugin cni 无法设置 pod "xxxxx"网络 : failed to set bridge addr: "cni0" already has an IP address different from10. x.x.x - 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61373366/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com