microk8s.kubectl requires sudo

Created on 20 Aug 2019  Â·  7Comments  Â·  Source: ubuntu/microk8s

$ snap info microk8s
installed:        v1.15.3                    (778) 171MB classic
$ microk8s.kubectl 
You do not have enough permissions to access MicroK8s. Please try again with sudo.

I noticed in the beta that microk8s.kubectl requires sudo (possibility related to #590).
Is there a way to add a user to a group or something so that they don't need to type sudo constantly?

Most helpful comment

After updating, I now get this message

$ microk8s.kubectl 
Insufficient permissions to access MicroK8s.
You can either try again with sudo or add the user dan to the 'microk8s' group:

    sudo usermod -a -G microk8s dan

The new group will be available on the user's next login.

I was able to resolve this issue by adding myself to the microk8s group, as suggested by the error message.

sudo usermod -a -G microk8s ${USER}
# open a new shell for the user, with updated group membership 
su - ${USER}

All 7 comments

There is no specific group. In https://github.com/ubuntu/microk8s/blob/feature/dev-docs/docs/access-without-sudo.md you can see a few methods to work around the sudo requirement including one that lets you permit your user/group to access critical files.

@ktsakalozos That link 404s.

@ktsakalozos That link 404s.

Oups, fixed.

after a sudo snap install microk8s --candidate --classic the solution Grant access to a user group is not working

@dcharbonnier could you try the edge channel (--edge instead of --candidate)?

After updating, I now get this message

$ microk8s.kubectl 
Insufficient permissions to access MicroK8s.
You can either try again with sudo or add the user dan to the 'microk8s' group:

    sudo usermod -a -G microk8s dan

The new group will be available on the user's next login.

I was able to resolve this issue by adding myself to the microk8s group, as suggested by the error message.

sudo usermod -a -G microk8s ${USER}
# open a new shell for the user, with updated group membership 
su - ${USER}

Same to me。

Was this page helpful?
0 / 5 - 0 ratings