Kubernetes 无法清理 Flannel

Kubernetes cannot cleanup Flannel

首先,我使用 Flannel 启动 Kubernetes 10.244.0.0

然后我全部重置并用10.84.0.0重新启动。

但是界面flannel.1还是10.244.1.0

我就是这样清理的:

kubeadm reset
systemctl stop kubelet
systemctl stop docker
rm -rf /var/lib/cni/
rm -rf /var/lib/kubelet/*
rm -rf /run/flannel
rm -rf /etc/cni/
ifconfig cni0 down
brctl delbr cni0
ifconfig flannel.1 down
systemctl start docker

我是不是在重置中遗漏了什么?

因为你的iplink有旧记录

ip link 可以看到记录,如果要清理old flannel和cni的记录

请尝试

ip link delete cni0 ip link delete flannel.1

在原来的命令中:

brctl delbr cni0
# deletes the cni0 interface

但是ifconfig flannel.1 down没有去掉接口。因此:

ip link delete flannel.1
# deletes the flannel.1 interface
# also, 'ip link delete cni0' was unnecessary since the brctl command deleted the link