How to export multipass / microk8s ports to macOS host?

I want to setup a local Kubernetes cluster for testing on macOS. I selected microk8s and multipass.

Installation was smooth and deployment of the kubernetes-bootcamp seemed to have worked. This is the output I got so far:

microk8s kubectl get services

NAME                  TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes            ClusterIP     <none>        443/TCP          5h9m
kubernetes-bootcamp   NodePort   <none>        8080:31004/TCP   4h10m

multipass list

Name                    State             IPv4             Image
microk8s-vm             Running      Ubuntu 18.04 LTS

Pinging the instance with ping works as expected.

Now when I shell into the VM using multipass exec microk8s-vm -- bash, I can curl into my deployed service as expected with both:

  • curl
  • curl

Getting the expected result of:

Hello Kubernetes bootcamp! | Running on: kubernetes-bootcamp-57978f5f5d-d977w | v=1

However I’m missing the step to access these url from macOS (both curl and a browser). I tried unsuccessfully:

  • curl
  • curl
  • curl
  • curl

I’m obviously missing a step to make the running services accessible from the macOS host. What did I miss? Help is very much appreciated!

Cross post from here:

1 Like

I would also like to know how we get that microk8s-vm take an IP from local network range. On MacOS microk8s relies on multipass which is annoying but when installing microk8s, we don’t get to launch (create) microk8s-vm with something like multipass launch --network en0 microk8s-vm

1 Like

Thanks for bringing this back up. We work together with the microk8s team to enable microk8s cross-platform, but we are hoping to create a way to launch microk8s directly from Multipass in the near future. We’ll make sure to take this into account as we build that. In the meantime I’ll flag this with the microk8s team to see if they have any ideas.