How to completely uninstall kubernetes

末鹿安然 提交于 2019-11-27 20:39:41

问题


I installed kubernetes cluster using kubeadm following this guide. After some period of time, I decided to reinstall K8s but run into troubles with removing all related files and not finding any docs on official site how to remove cluster installed via kubeadm. Did somebody meet the same problems and know the proper way of removing all files and dependencies? Thank you in advance.

For more information, I removed kubeadm, kubectl and kubelet using apt-get purge/remove but when I started installing the cluster again I got next errors:

[preflight] Some fatal errors occurred:
    Port 6443 is in use
    Port 10251 is in use
    Port 10252 is in use
    /etc/kubernetes/manifests is not empty
    /var/lib/kubelet is not empty
    Port 2379 is in use
    /var/lib/etcd is not empty

回答1:


use kubeadm reset command. this will un-configure the kubernetes cluster.




回答2:


In my "Ubuntu 16.04", I use next steps to completely remove and clean Kubernetes (installed with "apt-get"):

kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*   
sudo apt-get autoremove  
sudo rm -rf ~/.kube

And restart the computer.




回答3:


The guide you linked now has a Tear Down section:

Talking to the master with the appropriate credentials, run:

kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
kubectl delete node <node name>

Then, on the node being removed, reset all kubeadm installed state:

kubeadm reset


来源:https://stackoverflow.com/questions/44698283/how-to-completely-uninstall-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!