I get this error after I start the worker node VMs(Kubernetes) from the AWS console. I am using 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
I supppose that Flannel assigns a subnet lease to the workers in the cluster, which expires after 24 hours - and flannel.1 and cni0 /24 subnet no longer match, which causes this issue.
I also know a workaround:
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"
However is there any permanent fix to this?
TL;DR - recreate network
Or, as @ws_ suggested in comments - remove interfaces and restart k8s services:
Community solutions
It is a
known issueAnd there are some solutions to fix it.
Solution by filipenv is:
aysark: and kubernetes-handbook in a recipe for
Pod stuck in Waiting or ContainerCreatingboth recommendSome workarounds from Flannel's KB article
And there is an article in
Flannel's KB: PKS Flannel network gets out of sync with docker bridge network (cni0)Workaround 1:
WA1 is just like yours:
Workaround 2:
If WA1 didn't help, KB recommends: