Many people might be wondering if it’s possible to run k8s locally on the new Mac computers with Apple Silicon. The short answer is yes, it is possible. Here i will show you how i managed to get it done.
Note: I’m writing this on February 8th, 2021. As more support keeps coming for the new chips, this will be easier to do in the near future.
Docker
The first thing we need is to download the Apple M1 tech preview build:
https://docs.docker.com/docker-for-mac/apple-m1/
Just follow the instalation process and try to start it. If you are lucky enough, it will work just fine. If docker hangs during the startup, try to open the console.log and follow this steps:
-
Open /Library/preferences/SystemConfiguration/com.apple.vmnet.plist. You will see something like this:
<key>Shared_Net_Address</key> <string>192.168.64.1</string> <key>Shared_Net_Mask</key> <string>255.255.255.0</string>
-
On my console log, i saw that docker was starting but it was expecting some services on the 192.168.65.x network. By reading some github threads, i changed the file specified on the previous step and, in my case, had to be changed to 192.168.65.1. After opening Docker again, it worked like a charm.
Ok so now we have docker preview up and running 👌
Minikube
After a little research, i also found an open thread for minikube. You can see it here: https://github.com/kubernetes/minikube/issues/9224
Here are the steps to follow:
-
Download the minikube-darwin-arm64 file. You can find it on the previous link i shared or in here: https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
-
Let’s make it executable:
chmod +x minikube-darwin-arm64
-
Now we can rename it:
mv minikube-darwin-arm64 minikube
-
Move it to your $PATH:
sudo mv minikube /usr/local/bin/
Ok so after following this steps, you should be able to start minikube. In my case though, it failed a couple of times until i specified the driver “which is the only one supported for the moment”.
minikube start --driver=docker --alsologtostderr
After this, i could start using minikube without any issues. I also tested Terraform to create some resources and worked very well.
If you have any questions, feel free to ask in the comments section.