I installed the kubectl distribution using snap in ubuntu 18.04. Everything was working fine during my testing using the local kubernetes cluster that I installed with microk8s. But, when I tried to use the $HOME/.kube/config and adding information to manage multiple clusters, then I found that kubectl didn’t recognize the default config path at $HOME/.kube/config nor the env variable KUBECONFIG 1.

I solved this by adding the line --kubeconfig=${KUBECONFIG} to /var/snap/microk8s/current/args/kubectl. And, adding the line export KUBECONFIG=$HOME/.kube/config to /var/snap/microk8s/current/args/kubectl-env.

References