Fast Kubernetes Testing on macOS with k3s and Colima

In order to get a quick Kubernetes cluster for local development on macOS we can turn to Colima . Long story short, we can leverage Colima by itself to create the entire setup with networking to skip a lot of fuss.

To get started:

brew install colima

If you don’t already have the Kubernetes command line interface, kubectl , you should also install that now in order to interact with your cluster.

brew install kubectl

Afterwards, we can start a colima virtual machine with a Kubernetes cluster including the necessary networking tweaks without mucking around with any other tools. To unlock this magic add the following option to use the built in k3s Kubernetes cluster, --kubernetes. In order to also apply the network enhancments we’ll want to provide a second option --network-address.

So all together this simple command:

colima start --kubernetes --network-address

Will start the k3s cluster and have it up and running for development or testing. You can verify the cluster with the following command:

kubectl get po

Which should return something like:

No resources found in default namespace.

A helpful alias to avoid a lot of typing is alias k=kubectl.

References