DevOps

Running Kubernetes Locally with Kind

Standing up an EKS or GKE cluster just to try Kubernetes out is more than the occasion calls for. Local is fine. With Kind (Kubernetes in Docker), Docker is the only prerequisite and you get a disposable cluster in a couple of minutes.

What Kubernetes takes off your hands

Kubernetes Neon Logo

Run containers with plain Docker and somebody restarts them when they die, and scales them by hand when load climbs. Kubernetes automates that part:

  • Notices a dead container and starts it again
  • Adds or removes replicas as load changes
  • Replaces old versions gradually instead of all at once

Two words are enough to start: Cluster and Pod

A Cluster is the whole system — several machines (nodes) pooled together and treated as one set of resources. That's what Kind or GKE hands you.

A Pod is the smallest unit Kubernetes schedules, and it's the main departure from Docker: you don't run a container, you run a Pod that contains one. Peas in a pod — usually one pea, sometimes several sharing the shell.

Why Kind rather than Minikube

Minikube typically boots a VM. Kind runs the nodes themselves as Docker containers, so it starts faster and disappears completely when you delete it. That suits learning, where you want to break things and start over.

Actually running it

Written for macOS, but Linux and WSL are the same.

1. Install

brew install kind kind --version

2. Create a cluster

kind create cluster --name my-cluster

The first run downloads the node image, so give it a moment. When it finishes your kubectl context has switched to kind-my-cluster — worth confirming:

kubectl cluster-info --context kind-my-cluster

3. Run Nginx

kubectl create deployment nginx --image=nginx kubectl get pods

Once STATUS moves from ContainerCreating to Running, it's up. If it doesn't, the Events section of kubectl describe pod <name> will tell you whether it's stuck pulling the image or stuck being scheduled.

4. Reach it from a browser

The Pod lives inside the cluster, so nothing reaches it yet. Port-forward a local port to it:

kubectl port-forward deployment/nginx 8080:80

Open http://localhost:8080 and you should get the Nginx welcome page. That command has to keep running — kill it and the connection goes with it.

5. Tear it down

kind delete cluster --name my-cluster

The whole cluster goes. docker ps -a confirms nothing was left behind.

The thing worth knowing up front

A Kind cluster is confined to your local Docker, so a type: LoadBalancer Service will sit at <pending> for EXTERNAL-IP forever — there's no cloud provider to allocate one.

If you want to try external access, use port-forward, switch to NodePort, or recreate the cluster from a config file with extraPortMappings. Everyone hits this once; it's cheaper to hit it knowingly.