How to completely uninstall kubernetes

Kirill Liubun picture Kirill Liubun · Jun 22, 2017 · Viewed 124.3k times · Source

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

Answer

Rib47 picture Rib47 · Mar 13, 2018

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.