kind — Local Kubernetes Cluster — Part 1

In this article we will talk about how we can create a local Kubernetes cluster using kind

Unni P
2 min readApr 20, 2023
Image source — kind documentation

Kubernetes has become the de facto standard for container orchestration in the modern cloud computing world.

Introduction

  • kind (Kubernetes in Docker) is a tool to create Kubernetes cluster running inside Docker containers
  • Mainly used for testing and local development purposes
  • Uses same tooling and configuration as a production Kubernetes cluster

Features

  • Cost effective — No need to worry about cloud bills
  • Flexibility — No need to worry about breaking things
  • Fast iteration — Easily test new features

Installation

  • Spin up a Linux machine, here I’m using Ubuntu 20.04.6 LTS
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
  • Install Docker using the convenience script
$ curl -fsSL https://get.docker.com -o get-docker.sh

$
sudo sh get-docker.sh
  • Add your user to Docker group, logout and log back in. Now you can execute Docker commands as normal user
$ sudo usermod -aG docker $USER
  • Download and install kind binary from the releases page
$ wget https://github.com/kubernetes-sigs/kind/releases/download/v0.18.0/kind-linux-amd64

$
sudo install kind-linux-amd64 /usr/local/bin/kind

$
kind version
kind v0.18.0 go1.20.2 linux/amd64
  • Download and install kubectl binary
$ curl -LO https://dl.k8s.io/release/v1.26.3/bin/linux/amd64/kubectl

$
sudo install kubectl /usr/local/bin/kubectl

$
kubectl version --client --output yaml
clientVersion:
buildDate: "2023-03-15T13:40:17Z"
compiler: gc
gitCommit: 9e644106593f3f4aa98f8a84b23db5fa378900bd
gitTreeState: clean
gitVersion: v1.26.3
goVersion: go1.19.7
major: "1"
minor: "26"
platform: linux/amd64
kustomizeVersion: v4.5.7

Usage

  • Creating a cluster
$ kind create cluster --name dev
Creating cluster "dev" ...
✓ Ensuring node image (kindest/node:v1.26.3) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-dev"
You can now use your cluster with:

kubectl cluster-info --context kind-dev
  • Interacting to cluster
$ kubectl config use-context kind-dev 
Switched to context "kind-dev".

$
kubectl get nodes
NAME STATUS ROLES AGE VERSION
dev-control-plane Ready control-plane 10m v1.26.3
  • Deploying workload to cluster
$ kubectl run nginx --image=nginx --port=80
pod/nginx created

$
kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 22s
  • Deleting cluster
$ kind delete cluster --name dev
Deleting cluster "dev" ...
Deleted nodes: ["dev-control-plane"]

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Unni P
Unni P

Written by Unni P

SysAdmin turned into DevOps Engineer | Collaboration and Shared Responsibility

No responses yet

Write a response