Skip to content

Calico CNI切换Kube OVN CNI

oilbeater edited this page Jun 27, 2022 · 2 revisions

Wiki 下的中文文档将不在维护,请访问我们最新的中文文档网站,获取最新的文档更新。

  1. 卸载Calico组件,可以执行以下脚本内容
#!/usr/bin/env bash
set -ex

# cni flag
kubectl -n kube-public delete cm cni-calico

kubectl -n kube-system delete cm calico-config

# calico crd
kubectl delete crd felixconfigurations.crd.projectcalico.org
kubectl delete crd ipamblocks.crd.projectcalico.org
kubectl delete crd blockaffinities.crd.projectcalico.org
kubectl delete crd ipamhandles.crd.projectcalico.org
kubectl delete crd ipamconfigs.crd.projectcalico.org
kubectl delete crd bgppeers.crd.projectcalico.org
kubectl delete crd bgpconfigurations.crd.projectcalico.org
kubectl delete crd ippools.crd.projectcalico.org
kubectl delete crd hostendpoints.crd.projectcalico.org
kubectl delete crd clusterinformations.crd.projectcalico.org
kubectl delete crd globalnetworkpolicies.crd.projectcalico.org
kubectl delete crd globalnetworksets.crd.projectcalico.org
kubectl delete crd networkpolicies.crd.projectcalico.org
kubectl delete crd networksets.crd.projectcalico.org

# delete calico tunnel
for pod in $(kubectl -n kube-system get pod -l k8s-app=calico-node --no-headers | awk '{print $1}')
do
  kubectl exec -n kube-system "$pod" -- modprobe -r ipip
done

# calico-node
kubectl -n kube-system delete ds calico-node
kubectl -n kube-system delete sa calico-node
kubectl delete clusterrole calico-node
kubectl delete clusterrolebinding calico-node

# calico-kube-controllers
kubectl -n kube-system delete deploy calico-kube-controllers
kubectl -n kube-system delete sa calico-kube-controllers
kubectl delete clusterrole calico-kube-controllers
kubectl delete clusterrolebinding calico-kube-controllers
  1. 删除每台机器上的残留文件并重启
  • 根据环境具体情况,在每台机器执行删除
rm -f /etc/cni/net.d/10-calico.conflist
rm -f /etc/cni/net.d/calico-kubeconfig
  • 执行reboot命令,重启清理 calico 残留 iptables 和 ipset 规则
  1. 执行kube-ovn安装脚本,安装kube-ovn组件
Clone this wiki locally