Home KubernetesHow to Create a Local Kubernetes Cluster with kind

How to Create a Local Kubernetes Cluster with kind

by Knowledge Base Linux
How to Create a Local Kubernetes — How to Create a Local Kubernetes Cluster with kind

This article covers How to Create a Local Kubernetes in detail. Testing Kubernetes changes on a shared or cloud cluster is slow and risky: namespaces collide, bills grow, and a bad YAML file can disturb everyone. The fix is a disposable cluster on your own machine. Setting up a kind Kubernetes local cluster takes about two minutes, because kind (Kubernetes IN Docker) runs every node as a Docker container. In this guide you will install a kind Kubernetes local cluster on Ubuntu, grow it to three nodes, map ports for Ingress testing, and learn the workflow tricks that make kind the default choice for local development and CI pipelines.

What Is kind and When Should You Use a kind Kubernetes Local Cluster? – How to Create a Local Kubernetes

kind was created by the Kubernetes project to test Kubernetes itself, and it shows: clusters spin up fast, behave like the real thing, and can run multiple nodes — including multi-control-plane setups — on one machine. A kind Kubernetes local cluster is ideal for:

  • Learning and experimenting without cloud costs.
  • Developing applications and testing manifests before deployment.
  • CI pipelines that need a real API server (kind is the standard in GitHub Actions).
  • Reproducing issues against specific Kubernetes versions — kind images exist for many releases.

It is not a production tool: everything lives in Docker containers on one host, so there is no real fault tolerance. For a single-node learning cluster with a friendlier installer, compare our Minikube installation guide; for a real multi-machine cluster, see the kubeadm installation tutorial.

Prerequisites – How to Create a Local Kubernetes

  • A machine running Ubuntu (or any Linux, macOS, or Windows with WSL2) with Docker installed and running. Our Docker on Ubuntu 24.04 guide covers the setup.
  • At least 4 GB of free RAM (8 GB recommended for multi-node clusters).
  • kubectl installed, so you can talk to the cluster once it exists.

Step 1: Install kind

# Download the binary (amd64)
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind --version

Go users can instead run go install sigs.k8s.io/[email protected].

Step 2: Create Your First kind Kubernetes Local Cluster

kind create cluster --name dev
kubectl cluster-info --context kind-dev
kubectl get nodes
NAME                 STATUS   ROLES           VERSION
dev-control-plane    Ready    control-plane   v1.31.0

kind creates a kubeconfig context named kind-<cluster-name> and switches you to it automatically. One cluster is rarely enough for testing, and kind makes extras cheap:

kind create cluster --name staging
kind get clusters
kubectl config use-context kind-dev
https://kblinux.com/wp-content/uploads/2026/10/media-generation-kind-multi-node-0-43999e13-9bef-41f9-a7e3-e725c64b4287.webp

Step 3: Create a Multi-Node Cluster with a Config File

Real clusters have separate workers. Declare the topology in YAML:

# kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
kind create cluster --name lab --config kind-config.yaml
kubectl get nodes
NAME                STATUS   ROLES
lab-control-plane   Ready    control-plane
lab-worker          Ready    <none>
lab-worker2         Ready    <none>

Each “node” is a Docker container, which you can see with docker ps. You can even shell into one: docker exec -it lab-worker bash.

Step 4: Map Ports and Test an Ingress

By default, NodePort services inside kind are not reachable from your host. Map ports at creation time:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 80
    hostPort: 8080
  - containerPort: 443
    hostPort: 8443

Recreate the cluster with this config, install the NGINX Ingress controller using its kind-specific manifest, and your Ingress rules answer on http://localhost:8080. The full Ingress walkthrough is in our guide to installing the NGINX Ingress controller.

Step 5: Load Local Images and Clean Up

kind clusters cannot see images that only exist in your local Docker daemon until you load them:

docker build -t myapp:dev .
kind load docker-image myapp:dev --name lab
kubectl run myapp --image=myapp:dev --image-pull-policy=IfNotPresent

When you are finished, clusters delete as fast as they appeared:

kind delete cluster --name lab
kind delete clusters --all

Troubleshooting a kind Kubernetes Local Cluster

  • Cluster creation hangs or fails: Docker is not running, or another cluster with the same name exists. Check docker ps and kind get clusters.
  • Nodes NotReady / creation times out on slow machines: increase Docker’s CPU/RAM allocation; multi-node clusters on 4 GB hosts are tight.
  • ImagePullBackOff for your own image: you skipped kind load docker-image, or the tag is :latest, which defaults to always pulling. Pin a version tag and set imagePullPolicy: IfNotPresent.
  • Cannot reach a service from the host: expected without extraPortMappings or a kubectl port-forward. Port mapping must be defined at creation time — it cannot be added later.
  • Version mismatch with your target environment: create the cluster with a specific node image, for example --image kindest/node:v1.30.0.

Conclusion

A kind Kubernetes local cluster gives you a faithful, throwaway Kubernetes in minutes: one command to create, one to delete, and full multi-node topologies when you need them. It has become the standard sandbox for learning, manifest testing, and CI because it behaves like production without the invoice. Keep kind for everything local, and graduate to kubeadm or a managed service when the workload needs real machines. The official kind quick-start guide documents the remaining configuration options, including IPv6 and feature-gate testing.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.