CategoriesDevOpsTips and Tricks

Kubernetes Cluster Setup with Kind-k8s Installer

By following this guide, you’ll be able to quickly and easily set up a Kubernetes cluster on your Windows PC with the following tech stack

  • WSL2 backend with Ubuntu
  • Docker Desktop
  • Kubectl – Windows

K8s Kind Installer

Kind is a simple, lightweight CNCF-certified Kubernetes installer CNCF K8s Installer

Compared to Minikube, Kind provides support for Hyperkit on Mac and Hyper-V on Windows hypervisors, including features such as Load balancer and Ingress support. Additionally, Kind supports multi-node clusters, including those with high availability (HA).

Quick prerequisites installation

#Kubectl Kind using powershell

curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.22.0/kind-windows-amd64

Move-Item .\kind-windows-amd64.exe C:\Dev\env\kind\kind.exe

#Kubectl Install
curl.exe -LO "https://dl.k8s.io/release/v1.30.0/bin/windows/amd64/kubectl.exe

Create cluster

Creating a cluster with 1 control plane node and 3 workers

apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
name: ckad-cluster
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker

This will create all the necessary k8s control plane objects and worker nodes

These kind and Kubectl commands will required for cluster manipulation

kind get clusters
kind delete cluster
kubectl cluster-info

Ex:
tharinda@Tharinda-RIG MINGW64 /c/Dev/env/kind
$ kind get clusters
ckad-cluster

tharinda@Tharinda-RIG MINGW64 /c/Dev/env/kind
$ kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:60385
CoreDNS is running at https://127.0.0.1:60385/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

Bonus Topic

kubectl auto-completion

tharinda@Tharinda-RIG MINGW64 /c/Dev/env/kind
$ kubectl completion bash > ~/.kube/completion.bash.inc

$ printf "
# Kubectl shell completion
source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile

tharinda@Tharinda-RIG MINGW64 /c/Dev/env/kind
$ source $HOME/.bash_profile

Leave a Reply

Your email address will not be published. Required fields are marked *