23

I'm looking to see if it's currently possible to run Kubernetes locally on a 2020 M1 MacBook air.

The environment I need is relatively simple, just for going through some tutorials. As an example, this operator-sdk guide.

So far I've tried microk8s and minikube, as they're tools I've used before on other machines.

For both of these, I've installed them using brew after opening the terminal app "with Rosetta 2" (i.e like this). My progress is then:

Minikube

When I run minikube start --driver=docker (having installed the tech preview of Docker Desktop for M1), an initialization error occurs. It seems to me that this is being tracked here https://github.com/kubernetes/minikube/issues/9224.

Microk8s

microk8s install asks to install multipass, which then errors with An error occurred with the instance when trying to start with 'multipass': returned exit code 2. Ensure that 'multipass' is setup correctly and try again.. Multipass shows a microk8s-vm stuck in starting. I think this may relate to this issue https://github.com/canonical/multipass/issues/1857.

I'm aware I'd probably be better chasing up those issues for help on these particular errors. What would be great is any general advice on if it's currently possible/advisable to setup a basic Kubernetes env for playing with on an M1 mac. I'm not experienced with the underlying technologies here, so any additional context is welcome. :)

If anyone has suggestions for practising Kubernetes, alternative to setting up a local cluster, I'd also appreciate them. Thanks!

James Cockbain
  • 466
  • 2
  • 4
  • 13

2 Answers2

15

First, it is usually good to have Docker when working with containers. Docker now has a Tech Preview of Docker for Apple M1 based macs.

When you have a workin Docker on your machine, it should also work to use Kind - a way to run Kubernetes on Docker containers.

Jonas
  • 121,568
  • 97
  • 310
  • 388
  • Thank you! Yes, I have the Docker Tech Preview installed. Kind initially returned an error for me on `create cluster`, but using the image suggested [here](https://github.com/kubernetes-sigs/kind/issues/166#issuecomment-744417522) I was able to create a cluster. Following that thread it sounds like built-in support is on its way. – James Cockbain Jan 23 '21 at 21:10
  • @James Cockbain, are you able to run Kubernetes clusters using Kind in docker preview for apple silicon? – Karthikaiselvan R Feb 03 '21 at 19:13
  • 5
    @KarthikaiselvanR - yes, I was able to create a cluster using the image linked above ( `kind create cluster --image rossgeorgiev/kind-node-arm64:v1.20.0`) with the Docker Tech Preview running. I've used that cluster for the operator-sdk tutorial I mentioned in the question, plus some examples from the kubernetes.io docs. Nothing heavy-duty, but has been absolutely fine for me for those. – James Cockbain Feb 03 '21 at 21:01
  • @JamesCockbain, Thanks for your info. Cheers! – Karthikaiselvan R Feb 04 '21 at 20:22
  • 1
    So how do I connect to cluster? I was able to run `skaffold dev` and services were working but I couldn't connect to them with Ingress Nginx – Andrey Gritsay Feb 07 '21 at 19:43
  • 1
    @AndreyGritsay, Please have a look at [here](https://github.com/kubernetes/minikube/issues/9224#issuecomment-776189649) – Karthikaiselvan R Feb 11 '21 at 18:43
  • @KarthikaiselvanR I couldn't run minikubes for some reason, though yesterday Docker was updated with Kubernetes support! – Andrey Gritsay Feb 12 '21 at 15:45
  • 1
    @KarthikaiselvanR I have problems with the new updated version, too, because Kubernetes still stuck at starting progress. Are you using that built-in Kubernetes in docker desktop? – SayJeyHi Feb 14 '21 at 06:16
  • 2
    @SayJeyHi I have that problem with the built-in Kubernetes on Docker Desktop for m1 too. Only way I could find to get out of the "Kubernetes is starting" state was to do "Reset to factory defaults" from troubleshooting menu. I've now moved on from Kind to Minikube following the thread from above, and is working fine for me. Specifically, I followed the instruction in [this](https://github.com/kubernetes/minikube/issues/9224#issuecomment-772606796) video. – James Cockbain Feb 14 '21 at 09:22
  • @JamesCockbain, why you didn't use kind? was there any problems with it? – SayJeyHi Feb 14 '21 at 09:36
  • @SayJeyHi - sorry I could have worded that better! I still have Kind installed and works fine, but having got Minikube working yesterday I've been trying that out. I was able to to [connect to a service](https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/) on the cluster externally using Minikube - which is something I haven't managed with Kind. Apart from that, I'm not in a position yet to give a preference. – James Cockbain Feb 14 '21 at 09:57
  • This guy got kubernetes working, note that I installed the preview of docker beforehand: https://jimmyb.ninja/post/1609779188 – xxjjnn Feb 22 '21 at 11:57
  • How is it going by 2nd of September 2021. Could anyone please update ? – Nitesh chauhan Sep 02 '21 at 12:12
  • I'm trying this tut https://kubernetes.io/docs/tasks/access-application-cluster/connecting-frontend-backend/ with minikube on an M1 Mac mini and it doesn't create the backend pods - they just crash or error. I've had consistent problems with creating services - targetPorts don't seem to work. – Davtho1983 Oct 03 '21 at 20:26
2

Update (Jan 2022): I noticed that microk8s docs have published a tutorial for m1 installs. I followed this and it works fine on my machine now.

Additionally, I can also now setup a cluster on Minikube by following the instructions in the docs with ARM64 as my architecture.

James Cockbain
  • 466
  • 2
  • 4
  • 13