卸载docker和k8s

别靠近k8s集群,会带来不幸

一、卸载k8s

  1. 卸载containerd
     sudo apt-get purge   --auto-remove containerd.io
    
  2. reset集群
    sudo su
    kubeadm reset -f
    
  3. 卸载k8s
    sudo apt-get purge   --auto-remove kubernetes-cni
    sudo apt-get purge --auto-remove kubeadm
    sudo apt-get purge --auto-remove kubectl
    sudo apt-get purge --auto-remove kubelet
    
  4. 删除文件
    sudo su
    modprobe -r ipip
    rm -rf ~/.kube/
    rm -rf /etc/kubernetes/
    rm -rf /etc/systemd/system/kubelet.service.d
    rm -rf /etc/systemd/system/kubelet.service
    rm -rf /usr/bin/kube*
    rm -rf /etc/cni
    rm -rf /opt/cni
    rm -rf /var/lib/etcd
    rm -rf /var/etcd
    apt clean all
    apt remove kube*
    
  5. 利用dpkg命令查看是否还有k8s其他服务
    dpkg -l | grep kube
    
  6. 如果有,则执行以下命令删除,替换kube_name成软件名字
    sudo apt-get purge   --auto-remove kuber_name
    find / -name kube* -delete
    find / -name kube* | xargs rm -rf
    find / -name kube* | xargs rmdir
    
  7. 重启

二、卸载docker

sudo apt-get autoremove docker docker-ce docker-engine  docker.io  containerd runc
dpkg -l | grep docker
sudo apt-get autoremove docker-ce-*
sudo rm -rf /etc/systemd/system/docker.service.d
sudo rm -rf /var/lib/docker
docker --version

你可能感兴趣的:(Cloud,Native,kubernetes,docker,容器)