DEV Community

Rajit Paul
Rajit Paul

Posted on • Edited on

5 1

Setup KinD (Kubernetes In Docker) on Amazon EC2

Install Docker on Linux -

As I'm using an Amazon Linux I can install docker with a
yum install docker -y
Image description
Start docker service - systemctl start docker

For Docker Installations - https://docs.docker.com/engine/install/

Install Go -

Go to https://go.dev/dl/
Copy the link of go tarfile for linux platform
Install using wget
Image description
Extract it using tar zxf go1.17.7.linux-amd64.tar.gz -C /usr/local

  • Add /usr/local/go/bin to the PATH variable.

Install KinD

go install sigs.k8s.io/kind@v0.11.1
You can replace v0.11.1 with the latest stable kind version

Move the KinD Binary to /usr/local/bin -

  • You can find the kind binary inside the directory go/bin
  • Move it to /usr/local/bin - mv go/bin/kind /usr/local/bin
  • Make sure you have a path setup for /usr/local/bin

Install Latest Version of Kubectl:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin

Create a cluster with kind

kind create cluster --name labcluster
Image description
kubectl get nodes -o wide
Image description
docker ps
Image description

You are now running KinD successfully in Linux
Once done you can delete the cluster using
kind delete cluster

Multi-Node Cluster -

Create a config file kind-example-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:

  • role: control-plane
  • role: worker
  • role: worker

kind create cluster --config kind-cluster-config.yaml
Image description

You now have a running KinD Cluster with one master and two worker nodes.
kubectl get nodes -o wide
Image description

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (2)

Collapse
 
garvitjoshi profile image
Garvit Joshi

Nice Explanation!

Collapse
 
rajitpaul profile image
Rajit Paul

Thanks bhai

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay