Skip to content

Quickly set up a lightweight K3s cluster on macOS using Colima ​

Colima K3s schematic diagram

Cloud-native development on macOS often requires a local Kubernetes environment. Traditional Minikube is somewhat cumbersome, while the K8s included with Docker Desktop not only consumes huge resources but also has commercial licensing restrictions.

Colima As the best alternative for a lightweight container runtime on macOS, it not only fully supports everyday Docker use, but also has built-in support for K3s Excellent support. No complex configuration is required; a single command can spin up a native, lightning-fast K8s cluster.

1. Prerequisites: Install kubectl ​

⚠️ Extremely important prerequisites

It must be installed on the host machine in advance.kubectl Command-line tool! If specified when starting Colima --kubernetes parameters, but the host machine cannot find them kubectl, Colima's initialization process will exit abnormally.

It is recommended to install by downloading the official binary directly (fewer dependencies and cleaner than Homebrew):

bash
# 1. Download the latest version of kubectl (use amd64 for Intel Mac; for M chips, use arm64 instead)
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"

# 2. Grant execute permission
chmod +x ./kubectl

# 3. Move to the system path (if using Apple Silicon or M chip, it is recommended to place it in /usr/local/bin)
sudo mv ./kubectl /usr/local/bin/kubectl

Verify that the installation was successful:

bash
kubectl version --client

Under normal circumstances, you can see the following version information:

text
Client Version: v1.37.2
Kustomize Version: v5.8.1

II. One-click launch of a Colima virtual machine with K3s ​

Ensure kubectl After installation is complete, directly execute the following command in the command line to allocate 4 CPU cores and 6 GB of memory, and enable Kubernetes:

bash
colima start --cpu 4 --memory 6 --kubernetes

In-Depth Analysis of the Startup Process ​

During this process, Colima does a lot of work under the hood, and you will see logs similar to the following:

text
INFO[0000] starting colima
INFO[0000] runtime: docker+k3s
INFO[0000] creating and starting ...                     context=vm
INFO[0189] provisioning ...                              context=docker
INFO[0194] starting ...                                  context=docker
INFO[0195] provisioning ...                              context=kubernetes
INFO[0196] downloading and installing ...                context=kubernetes
INFO[0931] loading oci images ...                        context=kubernetes
INFO[0956] starting ...                                  context=kubernetes
INFO[0984] updating config ...                           context=kubernetes
INFO[0986] Switched to context "colima".                 context=kubernetes
INFO[0991] done

During these long few minutes (depending on network speed), Colima will pull and load the following core K3s images inside the virtual machine:

  • rancher/klipper-lb:v0.4.13(Service LoadBalancer implementation)

  • rancher/local-path-provisioner:v0.0.32(local storage volume)

  • rancher/mirrored-coredns-coredns:1.13.1(Cluster DNS)

  • rancher/mirrored-library-busybox:1.37.0

  • rancher/mirrored-library-traefik:3.5.1(default Ingress Controller)

  • rancher/mirrored-metrics-server:v0.8.0(Resource indicators)

And, Colima very intelligently executed it for you.Switched to context "colima", automatically took over your K8s configuration.

III. Verify Cluster Status ​

See INFO[0991] done Afterwards, directly in the macOS host terminal (no need ssh Enter the virtual machine) execute:

bash
kubectl get nodes

If everything goes well, you will see:

text
NAME     STATUS   ROLES                  AGE    VERSION
colima   Ready    control-plane,master   1m     v1.35.0+k3s1

At this point, a lightweight, native Kubernetes cluster has made its home on your Mac!

💡 Hardware performance tip

Regarding the performance of older devices: In actual testing on a 2017 MacBook Pro with 2 cores and 16GB of RAM (Intel chip), even running the extremely lightweight K3s feels noticeably strained (CPU resource bottleneck). It is strongly recommended to use a MacBook Pro with Apple Silicon (M-series chip) and 16GB or more of RAM as a local K8s development machine; the experience will improve dramatically.

最后更新2026/11/07 14:16
如果你觉得这篇文章有帮助,或者想聊聊技术、工作,欢迎通过下面方式联系我:
contact fishfinal