Title: Getting Started with Kubernetes Using KIND (Kubernetes IN Docker)

If you're just starting out with Kubernetes and want a quick, local, and resource-friendly setup, KIND (Kubernetes IN Docker) is a perfect tool. This blog will walk you through setting up a multi-node KIND cluster, configuring kubectl, and verifying everything works.

✨ Why Use KIND?

  • Ideal for local development and CI environments.

  • No need for VMs – it runs Kubernetes clusters in Docker containers.

  • Fast to set up and tear down.


✅ Prerequisites

  • Linux system (Ubuntu recommended)

  • Docker installed

  • Curl and basic shell knowledge


📁 Step 1: Install KIND and kubectl

Create a shell script to install both tools:

nano ./install_kind.sh

Paste the following content:

#!/bin/bash

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

VERSION="v1.30.0"
URL="https://dl.k8s.io/release/${VERSION}/bin/linux/amd64/kubectl"
INSTALL_DIR="/usr/local/bin"

curl -LO "$URL"
chmod +x kubectl
sudo mv kubectl $INSTALL_DIR/
kubectl version --client

rm -f kubectl
rm -rf kind

echo "kind & kubectl installation complete."

Run the script:

chmod +x install_kind.sh
./install_kind.sh
sudo apt-get update

Make sure Docker is installed:

sudo apt-get install docker.io
sudo usermod -aG docker $USER && newgrp docker

⚙️ Step 2: Create KIND Cluster Configuration

Create a directory and a config YAML:

mkdir kind-cluster
cd kind-cluster
nano kind-cluster-config.yaml

Paste the config:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
- role: worker
  image: kindest/node:v1.31.2
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP

Create the cluster:

kind create cluster --name=tws-cluster --config=kind-cluster-config.yaml

Check the cluster info:

kubectl cluster-info --context kind-tws-cluster
kubectl get nodes

⚠️ Common Issue: Connection Refused

You might see this error:

kubectl get nodes
E... couldn't get current server API group list: Get "http://localhost:8080/api?...": connect: connection refused

Fix:

kubectl config use-context kind-tws-cluster

🚀 What’s Next?

  • Try running a simple Pod: kubectl run nginx --image=nginx

  • Apply your first YAML: create a Namespace and deploy a Pod.

  • Learn about Namespaces, Deployments, and Services in the next blog.


Happy K8s-ing!

1
Subscribe to my newsletter

Read articles from Shraddha Modhera directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shraddha Modhera
Shraddha Modhera