Thursday, February 8, 2024

What Is Kubernetes and why we use it ?

 

What Is Kubernetes?

Kubernetes is an open-source orchestrating platform designed to automate the deployment, scaling, and management of containerized applications.


Understanding Software Architecture Evolution


1. Monolithic Architecture

A monolithic architecture is a single unified system where all functionalities are bundled together within a single codebase and deployed as one unit.

  • Ex: Facebook (Login, New User, Story, Post etc..)
  • Code ➡️ .war ➡️ Server ➡️ Database ➡️ Live

Problem: A small change in one module (e.g., Login) requires redeploying the entire application.


2. Microservices Architecture

To overcome monolithic limitations, businesses move toward a Microservices Architecture, where each feature is developed, deployed, and scaled independently.

Each service (Login, New User, Story, Post) is independent and interacts via an API gateway.

    • User ➡️ API-Gateway ➡️ API ➡️ Login ➡️ Database

    • User ➡️ API-Gateway ➡️ API ➡️ New User ➡️ Database

    • User ➡️ API-Gateway ➡️ API ➡️ Story ➡️ Database

    • User ➡️ API-Gateway ➡️ API ➡️ Post ➡️ Database

New Problem: Server Utilization & RAM Usage


3. Container Architecture

Problems with Scaling up the container

→ Container cannot communicate with each other

→ Autoscaling and Load Balancing was not possible.

→ Containers had to be managed carefully.


Kubernetes Container Management Tool

  • → Number of Container increased or decreased are Controlled by kubernetes as per Required.
  • → kubernetes can also control all the container e.g Docker, Rocket, container-D
  • → Kubernetes is an open-Source container Management tool which automates container. deployment, container Scaling & Load Balancing
  • → it schedules, runs and manages isolated container which are running of Virtual / physical/ cloud machine.
  • → All top Cloud Provider Support Kubernetes.


HISTORY

  • → Google developed on internal system called 'borg' (later named as omega) to deploy and manage thousands google application and services on their cluster.
  • → In 2014, google introduced Kubernetes an open. Source platform written in 'Golang' and later donated to CNCF. (Cloud Native Computey Foundation)


Online Platform for KBS.

  • → Kubernetes Playground
  • → Play with K8s.
  • → Play with Kubernetes Classroom


Cloud Based K8 Services

  • → GKE - Google Kubernetes Services
  • → AKS - Azure Kubernets Services
  • → Amazon EKS - (Elastic kubernetes Services)


Kubernetes Installation Tool

  • → Minicube
  • → Kubeadm


Features of Kubernetes

  • → Kubernetes Support JSON/YAML language
  • → orchestration (clustering of any no. of Container running on different n/w)
  • → Autoscaling(Vertical & Honzaital) and Auto Healing and load blancing.
  • → Platform Independent (cloud / Virtual / Physical)
  • → Fault Tolerance (Node/ POD failure)
  • → Rollback (going back to previous version)
  • → Health Monitoring of Container
  • → Batch Execution (one time, sequential, Parallel)



Why We Use Kubernetes ?

We use Kubernetes because it makes it easier to manage and scale applications, ensuring they run smoothly and reliably.
It simplifies tasks like deploying software, handling increased user traffic, and recovering from failures.
Kubernetes automates many aspects of managing applications in containers, providing a more efficient and flexible way to run and scale our software.


Architecture of kubernetes ?


1) Master Node:

  • a) Kubernetes API Server (Control Center): It's like the command center where you give orders. You tell it what you want (deploy an app, scale it up, etc.), and it makes things happen.
  • b) etcd (Memory): is kind of memory of the cluster. It stores all the information about the cluster - what apps are running, their configurations, etc.


2) Worker Nodes:


  • a) Kubelet (Worker's Supervisor): Each worker node has a supervisor called Kubelet. It listens to the API Server and ensures that the containers (your apps) are running as they should.
  • b) Kube-Proxy (Traffic Cop): This component helps manage network traffic between different pods and services. It ensures they can talk to each other.


3) Controller Manager (Task Manager):

This keeps an eye on the overall state of the cluster. If something goes wrong or if there's a difference between the desired state (what you want) and the actual state, the Controller Manager takes corrective actions.

4) Scheduler (Resource Organizer):

It decides which worker node should run your application based on available resources. If you say you want three copies of your app running, the Scheduler decides where to put those copies for the best performance.


  • In simple terms, the Master Node is the boss, the Worker Nodes do the actual work, the Controller Manager makes sure everything is as it should be, and the Scheduler decides where to put things. All these components work together to keep your applications running smoothly on a Kubernetes cluster. 



  • In the Kubernetes architecture diagram above you can see, there is one master and multiple nodes.
     
  • The Master node communicates with Worker nodes using Kube API-server to kubelet communication.
     
  • In the Worker node, there can be one or more pods and pods can contain one or more containers.
     
  • Containers can be deployed using the image also can be deployed externally by the user.

No comments:

Post a Comment

testing