123DevOps··6 min read

Lightweight Kubernetes on your machine: kind, k3d, minikube, and friends

Compare the main options for running Kubernetes locally, create clusters with kind, k3d, and minikube, load local images, expose your app with port-forward and Ingress, and avoid the most common mistakes.

Kubernetes

Testing a manifest directly on your team’s shared cluster is the fastest way to break everyone’s environment. A local Kubernetes cluster solves that: you spin up a disposable cluster in seconds or a few minutes, validate Deployments, Ingress, and Helm charts on your laptop, and delete everything when you’re done. The question is which tool to pick.

The available options

Almost all of them run Kubernetes nodes as containers or inside a lightweight VM, and all of them hand you a kubeconfig ready for kubectl.

Tool How it runs Startup Resource use Multi-node Best for
kind Nodes as Docker containers (upstream Kubernetes via kubeadm) Fast Low to medium Yes, via config file CI, testing controllers and manifests
k3d k3s inside Docker containers Very fast Low Yes (--servers, --agents) Day-to-day development with Ingress out of the box (Traefik)
minikube VM or container (docker, hyperkit, qemu, hyperv drivers…) Medium Medium Yes (--nodes) Learning, ready-made addons, many drivers
k3s Single binary installed directly on Linux (systemd service) Fast Low Yes, servers and agents VMs, edge, homelab, Raspberry Pi
MicroK8s Snap package on Linux Medium Medium Yes (microk8s add-node) Ubuntu workstations, addons via microk8s enable
Docker Desktop / Rancher Desktop / OrbStack Kubernetes built into the container app Fast (one click) Medium Usually a single node People already using the app who want zero setup

A few details that matter when choosing:

  • Docker Desktop ships a single-node cluster; recent versions can also provision clusters with kind. Rancher Desktop uses k3s and lets you pick the Kubernetes version. OrbStack is macOS-only and offers a lightweight single-node cluster. Check each one’s current documentation, because these features change often.
  • kind and k3d are the most common choices in CI pipelines, because they create and destroy clusters with a single command.
  • k3s isn’t a “laptop” tool: it’s a full distribution, also used in production at the edge.

Creating a cluster with kind

kind lets you describe the cluster in YAML. This example creates one control plane and two workers, and maps host ports 80 and 443 to the node that will run the Ingress controller:

# kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
  - role: control-plane
    kubeadmConfigPatches:
      - |
        kind: InitConfiguration
        nodeRegistration:
          kubeletExtraArgs:
            node-labels: "ingress-ready=true"
    extraPortMappings:
      - containerPort: 80
        hostPort: 80
        protocol: TCP
      - containerPort: 443
        hostPort: 443
        protocol: TCP
  - role: worker
  - role: worker
kind create cluster --name dev --config kind-config.yaml
kubectl cluster-info --context kind-dev
kubectl get nodes

Next, install an Ingress controller by following the Ingress page in the kind documentation. Heads up: the Kubernetes community has announced the retirement of the ingress-nginx project, so check which controller (or Gateway API implementation) the docs recommend today.

Creating a cluster with k3d

k3d runs k3s in containers and already includes Traefik as its Ingress. The -p flag publishes port 80 of k3d’s load balancer on port 8080 of your host:

k3d cluster create dev --agents 2 -p "8080:80@loadbalancer"
kubectl get nodes

Any Ingress in the cluster is reachable at http://localhost:8080.

Creating a cluster with minikube

minikube start --driver=docker --cpus=4 --memory=8g
minikube addons enable ingress
minikube addons enable metrics-server
minikube addons list

With the docker driver, minikube doesn’t need a hypervisor. For LoadBalancer and Ingress, run minikube tunnel in another terminal, or use minikube service <name> to open a Service in your browser.

Using locally built images

The local cluster doesn’t automatically see the images in your Docker: the nodes have their own container runtime. You have to load them:

docker build -t my-app:dev .

# kind
kind load docker-image my-app:dev --name dev

# k3d
k3d image import my-app:dev -c dev

# minikube: load the image...
minikube image load my-app:dev
# ...or build straight into minikube's Docker
eval $(minikube docker-env)
docker build -t my-app:dev .

Use a specific tag (such as :dev), never :latest. With :latest, the default imagePullPolicy is Always, the kubelet tries to pull the image from a registry, and the pod ends up in ErrImagePull. With any other tag, the default is IfNotPresent and the loaded image is used.

Deploying a sample app

kubectl create deployment web --image=my-app:dev --port=80
kubectl expose deployment web --port=80
kubectl port-forward svc/web 8080:80

port-forward is the quickest way to test. To validate real HTTP routing, create an Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web
spec:
  ingressClassName: traefik   # adjust to your cluster's controller
  rules:
    - host: web.localhost
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 80

On k3d, browse to http://web.localhost:8080; many systems resolve *.localhost to 127.0.0.1 automatically. For everyday commands, see the essential kubectl commands.

Day-to-day tips

Cap your laptop’s resources

Each cluster consumes CPU, memory, and disk. Set limits in Docker Desktop (or on the minikube VM with --cpus and --memory), run only the nodes you need, and stop what you’re not using: minikube stop, k3d cluster stop dev.

Multiple clusters and contexts

Each tool creates a context in your kubeconfig: kind-dev, k3d-dev, minikube. Before applying anything, confirm where you are:

kubectl config get-contexts
kubectl config use-context kind-dev

Cleaning up

kind delete cluster --name dev
k3d cluster delete dev
minikube delete --all

Orphaned images and volumes also take up disk space; review them periodically with docker system df.

When local isn’t enough

A local cluster doesn’t reproduce the cloud load balancer, real storage classes, IAM, provider network policies, or real traffic. To validate integrations, use ephemeral environments per pull request. To understand what happens behind every kubectl apply, read how Kubernetes works.

Checklist

  • Tool chosen by use case: kind/k3d for CI, minikube for addons, k3s for VMs
  • Cluster configuration versioned in the repository (kind-config.yaml or k3d script)
  • Local images loaded into the cluster and tagged with something other than :latest
  • Ingress tested with the correct port mappings
  • kubectl context checked before every apply
  • CPU and memory limits set, and clusters stopped when idle
  • Old clusters deleted regularly

The best local cluster is the one you can create, break, and recreate without fear in under a minute.

Get updates on new posts and stay in the loop!