microk8s: Fails on macOS Catalina

None of the commands provided for setting micro8s up or for reporting issues work on Catalina:

$ microk8s install
Support for 'multipass' needs to be set up. Would you like to do that it now? [y/N]: y
==> Downloading https://github.com/CanonicalLtd/multipass/releases/download/v1.3.0/multipass-1.3.0+mac-Darwin.pkg
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/114128199/2ced4a00-a9d8-11ea-82d1-074169520188?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJ
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'multipass'.
==> Installing Cask multipass
==> Running installer for multipass; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is multipass
installer: Installing at base path /
installer: The install was successful.
  🥃    multipass was successfully installed!
Waiting for multipass...
Launched: microk8s-vm
ping: snapcraft.io: Temporary failure in name resolution
An error occurred when trying to execute 'sudo ping -c 1 snapcraft.io' with 'multipass': returned exit code 2.
$ microk8s install
MicroK8s is up and running. See the available commands with `microk8s --help`.
$ microk8s stop
sudo: microk8s.stop: command not found
An error occurred when trying to execute 'sudo microk8s.stop' with 'multipass': returned exit code 1.
$ microk8s inspect
sudo: microk8s.inspect: command not found
An error occurred when trying to execute 'sudo microk8s.inspect' with 'multipass': returned exit code 1.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Seems to be caused by dnsmasq. Patched it with this change to /usr/local/Cellar/microk8s/2.1.0/libexec/lib/python3.9/site-packages/vm_providers/_base_provider.py

+            self.run("sed -i -e s/^#DNS=.*/DNS=8.8.8.8/ /etc/systemd/resolved.conf".split(), hide_output=True)
+            self.run("systemctl restart systemd-resolved.service".split(), hide_output=True)
            self.run("ping -c 1 snapcraft.io".split(), hide_output=True)

This fix no longer works, as the ping itself may fail on some MacOS situations. Instead, it’s better to test connectivity in a different way, for example:

+            self.run("sed -i -e s/^#DNS=.*/DNS=8.8.8.8/ /etc/systemd/resolved.conf".split(), hide_output=True)
+            self.run("systemctl restart systemd-resolved.service".split(), hide_output=True)
+             self.run("nslookup snapcraft.io".split(), hide_output=True)
-             self.run("ping -c 1 snapcraft.io".split(), hide_output=True)

Seems to be caused by dnsmasq. Patched it with this change to /usr/local/Cellar/microk8s/2.1.0/libexec/lib/python3.9/site-packages/vm_providers/_base_provider.py

+            self.run("sed -i -e s/^#DNS=.*/DNS=8.8.8.8/ /etc/systemd/resolved.conf".split(), hide_output=True)
+            self.run("systemctl restart systemd-resolved.service".split(), hide_output=True)
            self.run("ping -c 1 snapcraft.io".split(), hide_output=True)

I had the same problem (ping: snapcraft.io: Temporary failure in name resolution). It was caused by dnsmasq already running. After uninstalling it via brew and stopping the process (sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist), microk8s install worked without errors.

@joedborg

@jcayzac Thanks for trying. The quick option would be to use Virtualbox. If you already have it installed, you can run sudo multipass set local.driver=virtualbox. Otherwise, did you manage to go over the debugging steps in the docs I linked above?

I had the same problem with multipass. Virtualbox did the trick for me for a quick fix. Installed from here. Then ran sudo multipass set local.driver=virtualbox.

The installer downloads an image that should have microk8s installed but instead it’s just a regular Multipass VM with snap and nothing else installed.

This is partly true and partly false. A stock ubuntu VM is launched, and the installer then sets up MicroK8s by installing the snap

…/play/microk8s  microk8s status --wait-ready  heavy_check_mark  10081  11:30:34 sudo: microk8s.status: command not found

@sjmcdowall it appears that for some reason the installation failed. could you clean up and retry with:

# remove old vm
multipass delete microk8s-vm
multipass purge

# reinstall
microk8s install

Thanks!

I am on MacOS Monterey 12.6 - and can’t get microk8s up and running – having similar but slightly different issues from what I can see above …

Here is a set of error messages I am seeing – ` …/play/microk8s  microk8s install  ✔  10078  11:28:48 Launched: microk8s-vm An error occurred when trying to execute ‘sudo ping -c 1 snapcraft.io’ with ‘multipass’: returned exit code 1. …/play/microk8s  multipass exec microk8s-vm – sudo ping -c 1 snapcraft.io  2 ↵  10079  11:29:59 PING snapcraft.io (198.18.2.5) 56(84) bytes of data.

— snapcraft.io ping statistics — 1 packets transmitted, 0 received, 100% packet loss, time 0ms

…/play/microk8s  multipass exec microk8s-vm – sudo ping -c 1 1.1.1.1  1 ↵  10080  11:30:25 PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=54 time=95.2 ms

— 1.1.1.1 ping statistics — 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 95.214/95.214/95.214/0.000 ms …/play/microk8s  microk8s status --wait-ready  ✔  10081  11:30:34 sudo: microk8s.status: command not found An error occurred when trying to execute ‘sudo microk8s.status --wait-ready’ with ‘multipass’: returned exit code 1.`

I am not sure it’s DNS resolution since snapcraft.io resolves to 198.18.2.5 but that just sits there … which appears to resolve to localhost (?) via this netstat … which means something is supposed to be running on this address?? I am pretty much a total newbie on microk8s and snap and multipass …

This was a pure vanilla install via brew install ubuntu/microk8s/microk8s

Any help and direction would be greatly appreciated …

TIA!

Hi @joedborg

On the MAC OSx version of the microk8s, it doesn’t take any commands with a period, for example microk8s.enable and microk8s.kubectl will result in an error no matter what comes after it, instead you have to specify microk8s enable and microk8s kubectl. I was able to enable dns, dashboard, ingress, istio, fluentd, storage, metallb, etc. What I had a hard time with is the microk8s enable kubeflow because it always complained about the juju controller and installing helm charts results in network connectivity problems. The microk8s works really well as a host. The network bridge works well as well as long as you follow enable virtual box as the driver and enter in a few commands from the multipass.run website docs section.

In the mean time, I find the best solution for using microk8s on a MAC is using Parallels with Ubuntu 20.04. My mac is performing really well as the Kubernetes host with multiple machines connecting in the cluster. Everything works including Kubeflow.