<p>I'm trying to connect to microk8s cluster from remote host using kubectl</p>
<pre><code>kubectl config view
</code></pre>
<p>result:</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://ip:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: microk8s-admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: microk8s-admin
  user:
    password: password
    username: username
</code></pre>
<p>Credentials like ip, username, password I got using following command on server:</p>
<pre><code>sudo microk8s.config
</code></pre>
<p>result:</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: *certificate-data*
    server: https://**ip**:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: **user**
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: **password**
</code></pre>
<p>But if I use</p>
<pre><code>kubectl get node
</code></pre>
<p>I got an error: error: You must be logged in to the server (Unauthorized)</p>

<p>Instead of using username/password for kubectl user I should use just a token from microk8s.config</p>
