<p>I used below mentioned commands to remove kubernetes from my ubuntu 18.04 server.</p>

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

<p>but still its showing : </p>

<pre><code>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 .
</code></pre>

<p>How can i completely remove <code>kubectl</code> from my ubuntu server 18.04 ?</p>

<p>Depending on the method you chose in <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/tools/install-kubectl/</a>, it can be any of these:</p>

<p>Install kubectl binary via curl: <code>sudo rm /usr/local/bin/kubectl</code> </p>

<p>Download as part of the Google Cloud SDK: <code>gcloud components remove kubectl</code></p>

<p>Install with snap on Ubuntu (just as Gparmar said): <code>snap remove kubectl</code></p>

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