Pods failed to start after switch cni plugin from flannel to calico and then flannel
Asked Answered
M

1

2

I install kubernetes v1.11.5 from kubeadm with cni plugin flannel and everything is ok. But I after try to switch to calico I found that the cross machine pod communication is broken. So I switch back to flannel. But got error message when creating pod:

enter image description here

It seems that I need to reset cni network? But I don't know how to solve this problem.

My flannel and calico installation is follow kubeadm instruction with zero config update.

Mcbrayer answered 23/12, 2018 at 2:31 Comment(2)
It looks like a conflict between 2 different plugins. A lot of things could possibly went wromng. I guess the simplest solution in such case: setup new CNI from the scratchMeyeroff
You need to wipe out the cni. Calico and flannel are using different cidr. How to wipe out, cnblogs.com/jiuchongxiao/p/8942080.html. The content is in chinese. I tried the commands and it was ok for me.Enneagon
M
9

I use following steps to remove old calico configs from kubernetes without kubeadm reset:

  1. clear ip route: ip route flush proto bird
  2. remove all calico links in all nodes ip link list | grep cali | awk '{print $2}' | cut -c 1-15 | xargs -I {} ip link delete {}
  3. remove ipip module modprobe -r ipip
  4. remove calico configs rm /etc/cni/net.d/10-calico.conflist && rm /etc/cni/net.d/calico-kubeconfig
  5. restart kubelet service kubelet restart

After those steps all the running pods won't be connect, then I have to delete all the pods, then all the pods works. This has litter influence if you are using replicaset.

Mcbrayer answered 29/12, 2018 at 0:3 Comment(1)
you are my life saverSingh

© 2022 - 2024 — McMap. All rights reserved.