Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely uninstall kubernetes

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 
like image 320
Kirill Liubun Avatar asked Jun 22 '17 11:06

Kirill Liubun


People also ask

How do I uninstall k8s?

First, confirm the name of the node you want to remove using kubectl get nodes , and make sure that all of the pods on the node can be safely terminated without any special procedures. Next, use the kubectl drain command to evict all user pods from the node.


2 Answers

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.

like image 176
Rib47 Avatar answered Sep 21 '22 18:09

Rib47


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

like image 26
sfgroups Avatar answered Sep 24 '22 18:09

sfgroups