Running a local Kubernetes Cluster on an Apple Silicon MacBook
I wanted to test some stuff on my fairly new Mac, equipped with the M2 chip, and consequently, utilizes the arm64 architecture. I've bootstrapped a cluster using minikube at first, but due to some issues, switched to Docker desktop, which allowed me to "use Rosetta for x86/amd64 emulation on Apple Silicon" as I had issues with container images that were not built for this architecture. I could easily pull amd64 images using the platform flag, e.g.
docker pull IMAGE_NAME:TAG --platform linux/amd64
So I deployed stuff into my local cluster and ran into the following issue:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 18s default-scheduler Successfully assigned default/defectdojo-initializer-2023-11-25-23-16-64k2n to docker-desktop
Normal Pulling 18s kubelet Pulling image "defectdojo/defectdojo-django:latest"
Warning Failed 11s kubelet Failed to pull image "defectdojo/defectdojo-django:latest": no matching manifest for linux/arm64/v8 in the manifest list entries
Warning Failed 11s kubelet Error: ErrImagePull
Normal BackOff 11s kubelet Back-off pulling image "defectdojo/defectdojo-django:latest"
Warning Failed 11s kubelet Error: ImagePullBackOff
I tried to find an option to define the platform the container images should be for, without any success. But it looked like other people had similar issues
In the end, I've stumbled upon Colima
Got right into setting it up and starting up
$ colima start --kubernetes --arch x86_64 --cpu 8 --memory 8 --runtime containerd
INFO[0000] starting colima
INFO[0000] runtime: containerd+k3s
INFO[0000] creating and starting ... context=vm
INFO[0242] provisioning ... context=containerd
INFO[0242] starting ... context=containerd
INFO[0247] provisioning ... context=kubernetes
INFO[0248] downloading and installing ... context=kubernetes
INFO[0273] loading oci images ... context=kubernetes
INFO[0309] starting ... context=kubernetes
INFO[0337] updating config ... context=kubernetes
INFO[0338] Switched to context "colima". context=kubernetes
INFO[0339] done
Verify that everything is working as expected
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
colima Ready control-plane,master 5m50s v1.28.3+k3s2
I've tested my deployment again and the result was the following
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 7m28s default-scheduler Successfully assigned default/defectdojo-initializer-2023-11-26-00-25-7ckz2 to colima
Normal Pulling 7m22s kubelet Pulling image "defectdojo/defectdojo-django:latest"
Normal Pulled 24s kubelet Successfully pulled image "defectdojo/defectdojo-django:latest" in 6m57.795s (6m57.795s including waiting)
Normal Created 24s kubelet Created container initializer
Normal Started 23s kubelet Started container initializer
The only kinda limiting factor right now is the performance...