Installing Kubernetes Tools: Kind and Kubectl on AWS EC2 - A Simplified Guide
Did you know you can set up Kubernetes both locally and on the cloud? Pretty cool, right? If you’re thinking about running it locally, you’ve got some great options like Minikube, KOPs, and Kind. Today, let’s talk about Kind and how easy it makes running Kubernetes clusters right on your machine!
Let's assign roles to our K8S architecture:
kubectl: CEO
API server: Team Leader (TL)
Scheduler: Human Resources (HR)
Controller Manager: Project Manager (Headquarters)
Kubelet: Manager
Cluster: Company
Refer to the Kubernetes Architecture diagram below for our project:
Kubernetes Architecture Explained
K8S MANTRA: Everything in Kubernetes is a Manifest File (YAML File)
What is KIND?
KIND: KUBERNETES IN DOCKER.
You run Kubernetes inside a Docker container, and Docker runs in Kubernetes it's like inception.
Kind is a tool that creates and manages a local Kubernetes cluster using Docker containers.
Kind can run on AWS EC2, but for the cloud, there are specific managed services like EKS (Elastic Kubernetes Service), AKS (Azure Kubernetes Service), and GKE (Google Kubernetes Engine).
These are three cloud-managed Kubernetes clusters.
We will perform this on an AWS EC2 instance:
Visit the Kind setup/installation page: Kind Installation Steps
To run Kind, we need Docker.
Go to AWS and create an EC2 instance with the t2.medium instance type, as we are setting up both Master and Worker nodes.
Note: For creating an EC2 instance, you can refer to this blog:
- Choose a storage size of 15 GB.
Set up the key permissions and connect to the terminal using the SSH command.
Our prerequisite is Docker:
sudo apt-get update
sudo apt-get install docker.io #Installation of Docker
systemctl status docker #Check the status of docker service
- Docker is essential for running Kubernetes with Kind. Ultimately, we run applications in Docker, where these applications operate within containers. These containers use the Container Runtime Interface (CRI) internally. In Kubernetes, the same containers are used, but they are managed by a unit known as a POD.
What is POD?
A Pod in Kubernetes is the smallest deployable unit that contains one or more containers running, sharing the same network and storage, and working together as a single entity.
A POD is the most common collective noun for a group of Whales.
How to remember what a POD is:
- The Docker logo resembles a whale, and inside a POD, Docker containers run together, like a group carried by the whale.
If you want to know more about PODS please go through this link: PODs in K8S
How to Create a POD
Steps:
- Install Kind:
# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
# For ARM64
[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-arm64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
[ $(uname -m) = x86_64 ]: This is a conditional test to check if the architecture is
x86_64
. If true, it evaluates to success (0
exit code).curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
curl
: Command-line tool for downloading files from URLs.-L
: Follows redirects (useful for URLs that redirect to another location).-o ./kind
: Saves the downloaded file askind
in the current directory.https://kind.sigs.k8s.io/dl/v0.25.0/kind-linux-amd64
: URL pointing to the specific binary forkind
built for 64-bit Linux (amd64
).
This command checks if the system is 64-bit (
x86_64
) and, if true, downloads thekind
binary for 64-bit Linux from the specified URL, saving it locally askind
.
- Check if Kind is installed using the
ls
command:
Now make it executable:
chmod +x ./kind
Move it to the binaries directory so it works like a regular Linux command:
sudo mv ./kind /usr/local/bin/kind
Now we need to install Kubectl.
What is kubectl?
- This is the tool you use to interact with your cluster. Want to deploy a new app? Check on your containers? Just type a command with kubectl, and you’re directly communicating with Kubernetes!
How to install kubectl?
- Follow these steps: Click Here
Check the versions of kind and kubectl:
Now we're ready to create a K8S cluster! 😊
Happy Learning:)
Chetan Mohod
kind vs kubectl: Click Here
Subscribe to my newsletter
Read articles from Chetan Mohanrao Mohod directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Chetan Mohanrao Mohod
Chetan Mohanrao Mohod
DevOps Engineer focused on automating workflows, optimizing infrastructure, and building scalable efficient solutions.