microk8s: MacOS: Microk8s failing to enable kubeflow

Hi there,

Right after a fresh install of MicroK8s, enable kubeflow fails


==> /usr/local/Cellar/microk8s/2.0.1/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /private/tmp/microk8s--wheel-20201123-5266-1tpceaz/wheel-0.34.2
==> /usr/local/Cellar/microk8s/2.0.1/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /private/tmp/microk8s-20201123-5266-1quxj6/microk8s-installer-v2.0.1/installer
šŸŗ  /usr/local/Cellar/microk8s/2.0.1: 1,460 files, 13.9MB, built in 31 seconds
ddurand@macbook049 ~ % microk8s enable kubeflow
This command can't be run as root.
Try `microk8s enable kubeflow` instead.
Failed to enable kubeflow
An error occurred when trying to execute 'sudo microk8s.enable kubeflow' with 'multipass': returned exit code 1.
ddurand@macbook049 ~ % 

IIRC, when I enable kubeflow on Ubuntu I can do it with sudo otherwise I get a similar failure. It requires to be executed under a standard user. Maybe something similar here ?

Didier

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Hi @didier-durand,

You are right, this is a bug. The kubeflow addon expects the user to be in the microk8s group or it will fail with This command can't be run as root.. The microk8s OS native client executes all microk8s commands as root with sudo.

Here is a workaround, get a shell in the microk8s VM:

multipass shell microk8s-vm

Enable kubeflow by adding the user to the microk8s group:

sudo usermod -a -G microk8s $USER"
sudo chown -f -R $USER ~/.kube"

Restart the VM. Get a new shell and enable kubeflow:

multipass shell microk8s-vm
microk8s enable kubelfow

still not work

@ktsakalozos

I got the following result when I tried the workaround suggested. I use a macOS Big Sur version 11.1

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.15.0-130-generic x86_64)

System information disabled due to load higher than 2.0

0 updates can be installed immediately. 0 of these updates are security updates.

Last login: Thu Jan 14 12:26:42 2021 from 192.168.64.1 ubuntu@microk8s-vm:~$ sudo usermod -a -G microk8s $USER"

sudo chown -f -R $USER ~/.kube" usermod: user ā€˜ubuntu sudo chown -f -R ubuntu ~/.kube’ does not exist

@saulide - there’s a typo in the original command - kubelfow instead of kubeflow. That’s the error you are seeing - Nothing to do for kubelfow

For me, the workaround works only partially well. There comes a tail with it. For example, you need to set the right permissions for some files when calling microk8s from the outside of the vm (e.g. /var/snap/microk8s/1864/juju/share/juju/controllers.yaml) again and again. I’m looking forward to the patch. However, for me it seems not that trivial, since there was a commit to especially avoid enabling kubeflow as root.

Apparently, this issue appears on Windows 10 (at least Build 19042 with multipass 1.5.0-win64) as well. So this is not only a MacOS related issue.