k8s卸载calico的cni - Wed, Dec 16, 2020
k8s卸载calico的cni
1. 安装cni
1.1. Calico
ubeadm init --apiserver-advertise-address=192.168.1.118 --pod-network-cidr=192.168.0.0/16 --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers
### deployment
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
1.2. canal
ubeadm init --apiserver-advertise-address=192.168.1.118 --pod-network-cidr=192.168.0.0/16 --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers
### deployment
kubectl apply -f https://docs.projectcalico.org/manifests/canal.yaml
2. 卸载calico
2.1. Calico
kubectl delete -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
kubectl delete -f https://docs.projectcalico.org/manifests/custom-resources.yaml
2.2 canal
kubectl delete -f https://docs.projectcalico.org/manifests/canal.yaml
3. 系统配置修复
每个node下都会被配置系统文件,会导致奇怪的错误
清理/etc/cni/net.d/
# flannel
ifconfig flannel.1 down
ip link delete flannel.1
# calico
ifconfig vxlan.calico down
ip link delete vxlan.calico
# canal
ifconfig tunl0 down
ip link delete tunl0
rm -rf /var/lib/cni/
rm -f /etc/cni/net.d/*