注意:某些命令是按照预期编写进文档,仅个人参考,未实际尝试,不保证完全可用。
Flannel
# master
kubectl delete -f kube-flannel.yml
# kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# all nodes
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
ip link del kube-ipvs0
rm -rf /var/lib/cni/
rm -f /etc/cni/net.d/*
systemctl restart kubelet
systemctl restart network
# 如有必要,重启节点
Calico
# master
kubectl delete -f calico.yaml
# all nodes
modprobe -r ipip
ip link del kube-ipvs0
ip a | grep cali | awk -F ':' '{print $2}' | awk -F '@' '{print $1}' | xargs -i ip link del {}
rm -f /etc/cni/net.d/*
systemctl restart kubelet
systemctl restart network
# 如有必要,重启节点
Cilium
# master
cilium uninstall
# all nodes
ip a | grep cili | awk -F '{print $2}' | awk -F '@' '{print $1}' | xargs -i ip link del {}
ip link del kube-ipvs0
rm -f /etc/cni/net.d/*
systemctl restart kubelet
systemctl restart network
# 如有必要,重启节点
删除后查看node状态
kubectl get node
理想情况下是NotReady状态