<p>On my ubuntu laptop I was issuing some kubectl commands including running kubernetes from a local Docker container all was well ... at some point I then issued this command</p>

<pre><code>kubectl config set-cluster test-doc --server=https://104.196.108.118
</code></pre>

<p>now my local kubectl fails to execute ... looks like the Server side needs to get reset back to default</p>

<pre><code>kubectl version

Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.2", GitCommit:"528f879e7d3790ea4287687ef0ab3f2a01cc2718", GitTreeState:"clean"}
error: couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }
</code></pre>

<p>I deleted and reinstalled the gcloud SDK binaries and ran </p>

<pre><code>mv ~/.config/gcloud ~/.config/gcloud~ignore

gcloud init

gcloud components update kubectl
</code></pre>

<p>How do I delete my local kubectl settings (on ubuntu 16.04) and start fresh ?</p>

<p>It's important to note that you've set a <a href="http://kubernetes.io/docs/user-guide/kubeconfig-file/" rel="noreferrer">kubeconfig</a> setting for your <strong>client</strong>. When you run <code>kubectl version</code>, you're getting the version for client and the server which in your case seems to be the issue with the version command.</p>

<h2>Updating your config</h2>

<p>You need to update the setting to the appropriate information. You can use the same command you used to set the server to change it to the correct server.</p>

<p>If you want to wipe the slate clean in terms of client config, you should remove the kubeconfig file(s). In my experience with the gcloud setup, this is just <code>~/.kube/config</code>.</p>

<p>If you are running the cluster through google cloud engine, you can use gcloud to get the kubeconfig set for you as per the <a href="https://cloud.google.com/container-engine/docs/clusters/operations#switching_between_clusters" rel="noreferrer">container engine quick start guide</a>. The following assumes that you have defaults for the project, zone, and cluster set.</p>

<pre><code>gcloud container clusters get-credentials CLUSTER_NAME
</code></pre>

<h2>Removing kubectl - this isn't necessary</h2>

<p>If your goal is to wholesale get rid of kubectl, you should remove the component rather than reseting gcloud.</p>

<pre><code>gcloud components remove kubectl
</code></pre>

<p>But that won't solve your problem as it doesn't remove or reset <code>~/.kube/config</code> when I run it on Mac and if you want to keep working with it, you'll need to reinstall kubectl.</p>
