I was seeing the same thing, and took a shot at trying to enable some addons even though microk8s status wasn’t returning that it was running. When I tried to enable the addons I got a traceback that started helping me out:
$ microk8s enable ingress metallb:10.64.140.43-10.64.140.49 rbac storage dns
Traceback (most recent call last):
File "/snap/microk8s/3202/scripts/wrappers/enable.py", line 43, in <module>
enable(prog_name="microk8s enable")
File "/snap/microk8s/3202/usr/lib/python3/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/snap/microk8s/3202/usr/lib/python3/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/snap/microk8s/3202/usr/lib/python3/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/microk8s/3202/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/snap/microk8s/3202/scripts/wrappers/enable.py", line 36, in enable
enabled_addons, _ = get_status(get_available_addons(get_current_arch()), True)
File "/snap/microk8s/3202/scripts/wrappers/status.py", line 157, in get_status
kube_output = kubectl_get("all")
File "/snap/microk8s/3202/scripts/wrappers/common/utils.py", line 169, in kubectl_get
return run("kubectl", kubeconfig, "get", cmd, "--all-namespaces", die=False)
File "/snap/microk8s/3202/scripts/wrappers/common/utils.py", line 39, in run
result.check_returncode()
File "/snap/microk8s/3202/usr/lib/python3.6/subprocess.py", line 389, in check_returncode
self.stderr)
subprocess.CalledProcessError: Command '('kubectl', '--kubeconfig=/var/snap/microk8s/3202/credentials/client.config', 'get', 'all', '--all-namespaces')' returned non-zero exit status 1.
I decided to run the kubectl command manually and got:
$ kubectl --kubeconfig=/var/snap/microk8s/3202/credentials/client.config get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/calico-node-jxcdm 1/1 Running 0 13m
kube-system pod/calico-kube-controllers-f7868dd95-mx8dz 1/1 Running 0 13m
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 13m
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/calico-node 1 1 1 1 1 kubernetes.io/os=linux 13m
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/calico-kube-controllers 1/1 1 1 13m
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/calico-kube-controllers-f7868dd95 1 1 1 13m
Error from server (NotFound): Unable to list "autoscaling/v2, Resource=horizontalpodautoscalers": the server could not find the requested resource
Odd… I then tried to run the same command but using the config provided by microk8s config… This didn’t have any errors… I compared the two config files and the only difference was that /var/snap/microk8s/3202/credentials/client.config was using 127.0.0.1 where the one from microk8s config was using the machines IP… I changed client.config to use the machine IP and microk8s status started working.