How to make microk8s work with helm 3

This is a quick note for self. When running microk8s and trying to wire helm 3 I was getting “Error: Kubernetes cluster unreachable”. Workaround I found is the following:

mkdir /etc/microk8s
microk8s.config > /etc/microk8s/microk8s.conf
export KUBECONFIG=/etc/microk8s/microk8s.conf

This block above pretty much does the trick. Obviously, for production or near production use it’s worth adding cron and adding export command to something like .bash_profile.
P.s. What helped me a lot was this discussion of a similar issue for k3s: https://github.com/rancher/k3s/issues/1126