Skip to content

KinD Cluster Setup (Mac)

KinD (Kubernetes in Docker) runs Kubernetes clusters using Docker containers as nodes. It’s perfect for local development, testing, and CI/CD pipelines.

  • macOS with Homebrew installed
  • Docker Desktop running
  1. Install KinD using Homebrew

    Terminal window
    brew install kind
  2. Verify installation

    Terminal window
    kind version

Create a single-node cluster with default settings:

Terminal window
kind create cluster

Create a cluster with a specific name:

Terminal window
kind create cluster --name my-cluster

Create a cluster with multiple worker nodes using a config file:

kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
Terminal window
kind create cluster --config kind-config.yaml --name multi-node
Terminal window
kind get clusters
Terminal window
kubectl cluster-info --context kind-my-cluster
Terminal window
# Delete default cluster
kind delete cluster
# Delete named cluster
kind delete cluster --name my-cluster

KinD automatically configures kubectl to use the new cluster:

Terminal window
# View current context
kubectl config current-context
# List all nodes
kubectl get nodes
# Deploy a test application
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=NodePort

If you see “Cannot connect to the Docker daemon”, ensure Docker Desktop is running:

Terminal window
docker ps

Delete any existing cluster and try again:

Terminal window
kind delete cluster
kind create cluster