This blog contains the guide to setting up a working Minikube cluster on MAC M1/M2 arm64 systems using the Qemu emulator as the backend driver.
Qemu emulator is the best option to run a Kubernetes Cluster using minikube on MAC arm64-based systems without any issues. All other setups like Docker, Podman, and Virtualbox run into some sort of issue.
Setup Minikube on MAC M1/M2
Step 1: Install Qemu
Install the Qemu emulator using the following command.
brew install qemu
Step 2: Setup Qemu socket_vvmnet
For minikube service URLs to work, you need to start the socket_vmnet service
brew install socket_vmnet
brew tap homebrew/services
HOMEBREW=$(which brew) && sudo ${HOMEBREW} services start socket_vmnet
Step 3: Install minikube
brew install minikube
Step 4: Start Minikube with the Qemu driver and socket_vmnet
minikube start --driver qemu --network socket_vmnet
On successful execution, you should see the below output.
Validate Minikube Setup
Note: Ensure you have kubectl installed on your workstation.
To validate the setup let’s deploy a sample nginx application with a NodePort service. So that we can validate pod deployment as well as network access using the NodePort service.
Execute the following kubernetes manifest to deploy nginx deployment and a Nodeport service
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
name: web-service
spec:
ports:
- name: http
port: 80
selector:
app: web
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-deployment
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 80
EOF
Validate the deployment and service
kubectl get all
You should see an output as shown below.
To validate the networking, get the service URL using the following command. It will give you the node IP with NodePort in URL format.
minikube service web-service --url
Access the URL and you should be able to view the Nginx home page as shown below
Minikube Qemu Issues Issues
If you don’t have socket_vmnet running with Qemu and if you try to access Minikube service URLs, you will get the following error.
To rectify this, install the socket_vmnet using the commands given in step 2 under the setup guide.
❌ Exiting due to MK_UNIMPLEMENTED: minikube service is not currently implemented with the builtin network on QEMU, try starting minikube with '--network=socket_vmnet'
Conclusion
If you are new to Minikube, check out my Minikube tutorial where I have added all the required steps to get you started with a development Kubernetes cluster.
If you are learning Kubernetes, check out the Kubernetes learning path and Kubernetes tutorials for beginners.
12 comments
mac m fix minikube
sudo /usr/libexec/ApplicationFirewall/socketfilterfw –add /usr/libexec/bootpd >/dev/null 2>&1 && \
sudo /usr/libexec/ApplicationFirewall/socketfilterfw –unblock /usr/libexec/bootpd >/dev/null 2>&1
Thanks. The instructions worked like a charm.
Used the instructions on Mac Studio M2 Max on the MacOS 14.4
After minikube service web-service –url
system responds:
Unable to resolve the current Docker CLI context “default”: context “default”: context not found: and path
What I did next was:
docker context use default
and then all of it worked.
Very nice, thanks a million.
I followed the instructions without issue on a M1.
Don’t miss the k8 and minikube auto completion scripts you can add:
“`
source <(kubectl completion zsh)
source <(minikube completion zsh)
“`
You are welcome Stephen 🙂 Thanks for the tips
I think there is a typo, If I’m not wrong, MAC M2 is arm64 arch, not amd64 arch ?
Hi Bala,
We corrected it. Thanks for letting us know 🙂
Thanks for the quick reply!
I’m not using the corporate network. I have no proxy setup, I’ve also used different wifi connections, reboot the network but no luck. Also if get a ssh instance in the minikube vm there is no internet access 🙁
Seems that the VM has not internet access:
❗ This VM is having trouble accessing https://registry.k8s.io
💡 To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
Hi Liviu,
Looks like you are using the corporate network. Get in touch with your network team and set the HTTP proxy in the vm for external connectivity.
Thanks for the quick reply! I’m not using the corporate network. I have no proxy setup, I’ve also used different wifi connections, reboot the network but no luck. Also if get a ssh instance in the minikube vm there is no internet access 🙁
Not sure Liviu. You can try raising an issue with the Minikube community on Github. I am using MAC M2 and it works perfectly fine. Also, I hope you have enabled socket_vmnet for qemu.