Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 25, 2022 07:37 am GMT

Kubernetes: Whats, Whys, and Hows of Kubernetes with Demonstration

Why we need Kubernetes?

When It comes to heavy traffic on our website then we need to scale our App to handle more traffic. Also, It was a challenge earlier to make the App platform independent to ease the testing or usage on other machines.

Docker came as our life saver which made the dependencies and App package in a single container along with Hardware resources allocated for that container.

Docker Made the following things easy:-

  • We can run our App in containers that are machine independent
  • It made the implementation of Micro-services Architecture easy
  • Load Balancers can be used to distribute the load between the containers (For ex. Software Load balancers like NGINX)

Now we know we can balance the load between the containers as:-

Nginx and Docker

Wohoo Meme

But But But!!! What If the load on one container increases? Then we need the Scaling of containers. And What if containers need to communicate with each other?

These challenges are overcome using Container management or orchestration tool called Kubernetes (Also known as K8s).

What is Kubernetes?

Kubernetes is a Container management tool which provides us the various features to manage the containers. It facilitates the Micro-services Architecture.

Monolithic and Micro-services Architecture

Features of K8s:-

  • Automatic Bin-packing (It allocates the required resources to the container automatically)
  • Load Balancing (If one node is down or having high traffic then the incoming traffic will be re-directed to another container)
  • Self Healing
  • Batch Execution
  • Horizontal Scaling

Don't worry, we'll look into it if you haven't understood some.

Docker meme

Architecture of Kubernetes

Kubernetes Architecture

It follows the Master-Slave Architecture where the manifest file (YAML file that describes each component or resource of your deployment and the state you want your cluster to be in once applied) is stored inside the Master. K8s API and Master interacts with the Nodes and deploys the pods.

Pods are the fundamental units of k8s. Containers always resides inside the pods and Containers don't have their networking means they don't have their own IP or address, They will share the pod's IP and address.

Kubernetes or k8s Architecture

  • Master controls the cluster and the nodes inside it
  • Nodes hosts the containers inside them and containers are inside the separate pods.
  • In the above picture we have one cluster having three nodes

Setup of Minikube and What is KubeCTL?

Production cluster setup

In the above picture you can see that in production we have many resources such that we can make different clusters. But to test on our local machine we can use minikube.

Minikube

Minikube will create a virtual box in our machine and Node will run in that virtual Box (Virtual Node). In other words, Minikube is a one node k8s cluster that runs in a virtual box in our laptop.

To interact with the cluster we need KubeCTL (Kubernetes command line tools)

k8s architecture

In the above picture you can see that Master process communicate with the API server. It does that either using UI, API or CLI (KubeCTL). Note that we are talking about the virtual node in the local machine.

KubeCTL can be used for both the Local machine Node or the cloud cluster.

Kubectl usage

Note:- You need to install HyperKit or some kind of Hypervisor first.

  • After Installation of MiniKube, Type Minikube in the CommandLine

Minikube

  • Now, type Minikube start but make sure you start the Docker first.

Now, you can use Minikube and Follow this Cheat Sheet for Basic commands.

Follow for more interesting blogs. Drop a like and save for future.


Original Link: https://dev.to/lovepreetsingh/kubernetes-whats-whys-and-hows-of-kubernetes-with-demonstration-28dn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To