There are a few options for installing a Kubernetes development environment on a Mac: Minikube, KiND, K3d (K3s). I'll use K3d here because it has a small footprint, and it more closely matches the K8s production environment with Rancher that I work with.


Install K3d

K3d is a lightweight wrapper to run k3s (Rancher Lab’s minimal Kubernetes distribution) in Docker. The latest K3d version can be installed with brew install k3d (and removed with brew remove kd3). It installs to "/usr/local/bin"

If the latest version of K3s is incompatible with something else in your stack, install a specific version TAG like:

curl -s | TAG=v4.4.7 bash

Check version

k3d --version
expected output k3d version v4.4.7 k3s version **v1.21.2**-k3s1 (default)

Create a cluster

k3d cluster create

Clear cache and start from scratch
k3d cluster delete - only deletes default cluster

k3d cluster delete k3s-rancher
k3d cluster delete k3s-wordpress
rm -rf /Users/macusername/.kube/cache/*
rm /Users/macusername/.kube/config

Install Helm

Helm is a package manager for Kubernetes, which coordinates the download, installation, and deployment of apps. It defines an application as a collection of related Kubernetes resources.

Install Helm with brew

brew install helm@3

Check version

helm version
expected output version.BuildInfo{Version:"v3.7.0", GitCommit:"eeac83883cb4014fe60267ec6373570374ce770b", GitTreeState:"clean", GoVersion:"go1.17"}

Install kubectl (kubernetes-cli)

The latest kubernetes-cli can be installed with brew install kubectl.

If the latest version of K3s is incompatible with something else in your stack, see Install and Set Up kubectl on macOS for the right binary that works with your macOS type, and install a specific GitVersion release like:

curl -LO "" && \
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl && \
sudo chown root: /usr/local/bin/kubectl

Check version

kubectl version
expected output Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"**v1.21.2**", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"}

Create a Default Cluster (test)

k3d cluster create
kubectl config use-context k3d-k3s-default

Get info

kubectl cluster-info
kubectl get nodes


k3d cluster delete

Create a Rancher Cluster

k3d cluster create k3s-rancher \
  --api-port 6550 \
  --servers 1 \
  --agents 3 \
  --port 443:443@loadbalancer

Get info

kubectl cluster-info
kubectl get nodes,all


k3d cluster delete k3s-rancher
docker image rm ... the images ...


Install k3d/k3s, helm, kubectl, Rancher

Install Helm