• del.sh
#!/bin/bash
sudo kubeadm reset -f
sudo rm -rvf $HOME/.kube
sudo rm -rvf ~/.kube/
sudo rm -rvf /etc/kubernetes/
sudo rm -rvf /etc/systemd/system/kubelet.service.d
sudo rm -rvf /etc/systemd/system/kubelet.service
sudo rm -rvf /usr/bin/kube*
sudo rm -rvf /etc/cni
sudo rm -rvf /opt/cni
sudo rm -rvf /var/lib/etcd
sudo rm -rvf /var/etcd
sudo apt-get remove kube*

删除1.24 安装1.23.6

sudo apt autoremove kubelet kubeadm kubectl
sudo apt-get remove kubernetes-cni


sudo apt-get remove -y kubelet=1.24.0-00 kubeadm=1.24.0-00 kubectl=1.24.0-00   //删除旧的
sudo apt-get remove -y kubelet=1.23.6-00 kubeadm=1.23.6-00 kubectl=1.23.6-00 

#可以查看都可以安装什么版本
sudo apt-cache madison kubeadm 
sudo apt-get install -y kubelet=1.23.6-00 kubeadm=1.23.6-00 kubectl=1.23.6-00
sudo apt-get install -y kubelet=1.24.0-00 kubeadm=1.24.0-00 kubectl=1.24.0-00
sudo apt-get install -y kubelet=1.24.1-00 kubeadm=1.24.1-00 kubectl=1.24.1-00
sudo systemctl enable kubelet && sudo systemctl start kubelet

sudo apt-get remove kubernetes-cni
sudo apt search kubernetes-cni
sudo apt-cache search kubernetes-cni
sudo apt-get install kubernetes-cni #或者dpkg -i kubernetes-cni_0.5.1-00_amd64.deb

删除网络


#第一步,在master节点删除flannel
kubectl delete -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

#第二步,在node节点清理flannel网络留下的文件
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
rm -f /etc/cni/net.d/*
注:执行完上面的操作,重启kubelet