<p>I have been trying to learn Kubernetes with Docker to run containers and manage them with Kubernetes.</p>

<p>I use this web-page for installations: <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/tools/install-kubectl/</a></p>

<p>I have my own Debian/Linux server machine that I want to build and configure Kubernetes.</p>

<p>After following the <code>kubectl</code> installation steps, I get an error like:</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:23:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
Error from server (NotFound): the server could not find the requested resource
</code></pre>

<p><strong>kubectl version --short:</strong></p>

<pre><code>Client Version: v1.16.3
Error from server (NotFound): the server could not find the requested resource
</code></pre>

<p><strong>microk8s.kubectl version --short:</strong></p>

<pre><code>Client Version: v1.16.3
Server Version: v1.16.3
</code></pre>

<p>I have tried the local <code>microk8s</code> and used as <code>microk8s.kubectl</code> and with that installation, I was able to configure and even make the container work. However, the regular <code>kubectl</code> can not find the server. These two have different installations and different names, folders etc. I assume that one will not break or have any impact on the other one.</p>

<p>Edit: Based on the suggestion of Suresh, I did <code>kubectl config view</code> and the result is:</p>

<pre><code>apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
</code></pre>

<p>Does anyone have any idea how to solve this problem?</p>

Sojimanatsu
<p><code>microk8s.kubectl config view --raw &gt; $HOME/.kube/config</code></p>

<p>If you already have kubectl installed and you want to use it to access the microk8s deployment you can export the cluster's config with <a href="https://github.com/ubuntu/microk8s/blob/eb1183bba6da68982ce816a5ea4656591f9ecdfa/README.md#accessing-kubernetes" rel="nofollow noreferrer">accessing-kubernetes on microk8s</a></p>

<p>Microk8s put the kubeconfig file at different location.</p>

<blockquote>
  <p>To avoid colliding with a kubectl already installed and to avoid overwriting any existing Kubernetes configuration file, microk8s adds a microk8s.kubectl command, configured to exclusively access the new microk8s install. When following instructions online, make sure to prefix kubectl with microk8s.</p>
</blockquote>

<pre><code>microk8s.kubectl get nodes
microk8s.kubectl get services 
</code></pre>
