Uninstall Kubernetes from ubuntu 18.04

10/1/2019

I used below mentioned commands to remove kubernetes from my ubuntu 18.04 server.

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

but still its showing :

Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server `localhost:8080 was refused - did you specify the right host or port?   while running kubectl version .

How can i completely remove kubectl from my ubuntu server 18.04 ?

-- Niladri Dey
kubernetes

2 Answers

10/22/2019

Depending on the method you chose in https://kubernetes.io/docs/tasks/tools/install-kubectl/, it can be any of these:

Install kubectl binary via curl: sudo rm /usr/local/bin/kubectl

Download as part of the Google Cloud SDK: gcloud components remove kubectl

Install with snap on Ubuntu (just as Gparmar said): snap remove kubectl

In addition, you may need to remove the configuration files in ~/.kube.

-- user3292394
Source: StackOverflow

10/1/2019

If you exectute commands below:

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

remember to restart computer.

-- MaggieO
Source: StackOverflow