kubernetes


Introduction
This article provides an introduction to Kubernetes, a popular container orchestration platform known as k8s, which simplifies deploying, scaling, and managing containerized applications. It highlights the prerequisites of Docker knowledge and the utility of Kubernetes for auto-healing, autoscaling, and system observation. Key concepts include nodes, clusters, images, containers, and pods. The article also offers practical guidance on creating Kubernetes clusters using tools like Kind and Minikube, both locally and on cloud platforms such as GKE and AWS K8s.
What is kubernetes
Docker is a pre-requisite before you proceed to understand kubernetes
Kubernetes (popularly known as k8s) is a container orchestration engine
, which as the name suggests lets you create, delete, and update containers
This is useful when
You have your docker images in the docker registry and want to deploy it in a
cloud native
fashionYou want to
not worry about
patching, crashes. You want the system toauto heal
You want to autoscale with some simple constructs
You want to observe your complete system in a simple dashboard
💡
Kubernetes is also known as k8s. K_ _ s
Before kubernetes
Backend
Frontend (Nextjs)
Frontend (React)
After kubernetes
Your frontend, backend are all pods
in your kubernetes cluster
Jargon
Ref - https://kubernetes.io/docs/concepts/overview/components/
Nodes
In kubernetes, you can create and connect various machines together, all of which are running kubernetes
. Every machine here is known as a node
There are two types of nodes
Master Node (Control pane) - The node that takes care of deploying the containers/healing them/listening to the developer to understand what to deploy

Worker Nodes - The nodes that actually run your Backend/frontend

Cluster
A bunch of worker nodes + master nodes make up your kubernetes cluster
. You can always add more / remove nodes from a cluster.
Images
A Docker image is a lightweight, standalone, and executable software package that includes everything needed to run a piece of software, including the code, runtime, libraries, environment variables, and configuration files. Images are built from a set of instructions defined in a file called a Dockerfile.
Eg - https://hub.docker.com/_/mongo
Containers
A container is an image in execution. For example if you run
docker run -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
Pods
A pod is the smallest and simplest unit in the Kubernetes object model that you can create or deploy
Creating a k8s cluster
Locally (Make sure you have docker)
minukube
On cloud
GKE
AWS K8s
vultr
Using kind
- Install kind - https://kind.sigs.k8s.io/docs/user/quick-start/#installation
Single node setup
- Create a 1 node cluster
kind create cluster --name local
- Check the docker containers you have running
docker ps
You will notice a single container running (control-pane)
Delete the cluster
kind delete cluster -n local
Multi node setup
- Create a
clusters.yml
file
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- Create the node setup
kind create cluster --config clusters.yml --name local
- Check docker containers
docker ps
Now you have a node cluster running locally
Using minikube
Install minikube - https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download
Start a k8s cluster locally
minikube start
- Run
docker ps
to see the single node setup
💡
A single node setup works but is not ideal. You don’t want your control pane to run containers/act as a worker.
Subscribe to my newsletter
Read articles from soni raja directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

soni raja
soni raja
I'm cloud and devops for crafting robust and scalable solutions. With expertise in languages such as C/C++, JavaScript, and Node.js and a keen eye for optimizing database performance and mainting CI/CD piplines, I specialize in building and deploying web applications on servers. I've successfully implemented and maintained various backend systems, ensuring seamless functionality and a positive user experience. I'm excited about the prospect of collaborating on impactful projects and contributing my skills to innovative solutions.