Easy install Kubernetes cluster with kind on windows 11
Well I was exploring ways to install a Kubernetes cluster in my machine, then I found out about Kind.
Now what is Kind ? Its a tool for running local Kubernetes clusters using Docker containers as nodes. Kind was primarily designed for testing Kubernetes itself, but may be used for local development.
Prerequisites:
Docker
Kubectl
To install docker on your machine you can follow the steps here.
For installing kubectl, follow this.
Once this is done lets proceed to install kind.
Setting up Kind:
Run the following command using powershell-
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.24.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe c:\some-dir-in-your-PATH\kind.exe
Under Advanced system settings” > Click on “Environment Variables” under “System Variables” set new “Path” variable to "c:\some-dir-in-your-PATH\kind.exe"
Now to create a default kind cluster -
kind create cluster
It will create a cluster with 1 node --"kind-control-plane"
You can check cluster info with this command -
kubectl cluster-info --context kind-kind
Creating cluster with worker nodes:
Now lets create a kind cluster with 2 worker nodes -
Create a kind.yaml file with content below.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
Save the file and when creating the cluster, use the --config option to introduce the new cluster configuration:
kind create cluster --config kind.yaml --name Demo-cluster
Check cluster details:
kubectl cluster-info --context kind-Demo-cluster
Now to create it with ingress, use the below config file
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: kind
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 8080
protocol: TCP
- containerPort: 443
hostPort: 44300
protocol: TCP
- role: worker
- role: worker
Now run the command to create cluster and get the nodes details:
kind create cluster --config kind.yaml --name demo-cluster
PS D:\> kubectl get nodes
NAME STATUS ROLES AGE VERSION
demo-cluster-control-plane Ready control-plane 3m40s v1.31.0
demo-cluster-worker Ready <none> 3m27s v1.31.0
demo-cluster-worker2 Ready <none> 3m27s v1.31.0
Lets check the pods created:
PS D:\> kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-6f6b679f8f-5wj7s 1/1 Running 0 6m15s
kube-system coredns-6f6b679f8f-fvm2s 1/1 Running 0 6m15s
kube-system etcd-demo-cluster-control-plane 1/1 Running 0 6m22s
kube-system kindnet-4xrd2 1/1 Running 0 6m10s
kube-system kindnet-ndrrk 1/1 Running 0 6m10s
kube-system kindnet-vgw4q 1/1 Running 0 6m15s
kube-system kube-apiserver-demo-cluster-control-plane 1/1 Running 0 6m22s
kube-system kube-controller-manager-demo-cluster-control-plane 1/1 Running 0 6m21s
kube-system kube-proxy-b29wr 1/1 Running 0 6m15s
kube-system kube-proxy-f5ddp 1/1 Running 0 6m10s
kube-system kube-proxy-j8v8v 1/1 Running 0 6m10s
kube-system kube-scheduler-demo-cluster-control-plane 1/1 Running 0 6m22s
local-path-storage local-path-provisioner-57c5987fd4-zm5fr 1/1 Running 0 6m15s
Subscribe to my newsletter
Read articles from Siddharth Mehta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Siddharth Mehta
Siddharth Mehta
I am a DevOps Engineer specializing in Kubernetes, Linux, and AI technologies. With a strong focus on automation and scalability, I write about the latest in infrastructure management, container orchestration, and the integration of AI into DevOps workflows. Passionate about sharing knowledge, I help others navigate the complexities of modern tech through concise, insightful content.