Thursday, June 6, 2024

 KUBERNETES Architecture

 A Kubernetes cluster is a set of physical or virtual machines and other infrastructure resources that are needed to run your containerized applications. Each machine in a Kubernetes cluster is called a node. There are two types of node in each Kubernetes cluster:

Master node(s): this node hosts the Kubernetes control plane and manages the cluster

Worker node(s): runs your containerized applications


Kubernetes Control Plane

Kubernetes is a leading standard in the world of container orchestration. At the center of this powerful platform lies the Kubernetes control plane, which is responsible for orchestrating and regulating the entire Kubernetes cluster.

The Kubernetes control plane is a set of components that collectively make decisions about the state of the cluster. It manages the overall cluster and its nodes, ensuring that the desired state—defined by the user or applications—is maintained. The control plane components communicate with one another and with nodes to orchestrate and coordinate the deployment, scaling, and operation of applications within the Kubernetes cluster.

https://kubernetes.io/docs/concepts/overview/components/


Core Components of the Kubernetes Control Plane

The Kubernetes control plane is the brain behind a Kubernetes cluster, and it’s responsible for managing the cluster’s state, coordinating operations, and maintaining overall cluster health. There are several components that make up the control plane. These include:

API server: This is the central component of the control plane that exposes the Kubernetes API. It acts as the entry point for all operational commands and management tasks. . One of the main components on the master node is called the API server. The API server is the endpoint that Kubernetes CLI (kubectl) talks to when you're creating Kubernetes resources or managing the cluster

etcd: This consistent and highly available key-value store is used as the cluster’s primary database. It stores configuration data, state information, and metadata about the cluster.

Controller manager: This watches the shared state of the cluster through the API server. Also, it ensures that the current state matches the desired state and manages various controllers for nodes, endpoints, replication, and more.

Scheduler: The scheduler is responsible for assigning nodes to newly created pods based on resource availability and constraints. It also monitors the resource usage of individual nodes and makes decisions about where to deploy new pods.The scheduler component works together with the API server to schedule the applications or workloads on to the worker nodes. It also knows about resources that are available on the nodes as well as the resources requested by the workloads. Using this information it can decide which worker nodes your workloads end up on.

WORKER NODES

Just like on the master node, worker nodes have different components running as well. 

Container runtime :The container runtime in a worker node is responsible for running containers. The container runtime is also responsible for pulling container images from a repository, monitoring local system resources, isolating system resources for the use of a container, and managing the container lifecycle.

 

kubelet  :An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.Just like on the master node, worker nodes have different components running as well. The first one is the kubelet. This service runs on each worker node and its job is to manage the container. It makes sure containers are running and healthy and it connects back to the control plane. Kubelet talks to the API server and it is responsible for managing resources on the node it's running on.

kube-proxy: implements essential functionalities for Kubernetes services.  kube-proxy maintains network rules that allow communication to your Pods from network sessions inside or outside your cluster.

Kubernetes Architecture in Layman Terms

Imagine you’re managing a big hotel with many rooms. Each room represents a computer or server where you want to run your applications. Kubernetes is like the manager of this hotel, ensuring that all the rooms are used efficiently and that guests (applications) get the services they need.

Key Components of Kubernetes Architecture

  1. Control Plane (Hotel Management Office):
    • This is the brain of Kubernetes, managing the whole system. It ensures that everything runs smoothly and that there are no conflicts.
  2. Nodes (Hotel Rooms):
    • These are the actual servers or computers where your applications run. Each node can host multiple applications, just like a hotel room can host different guests.
  3. Pods (Hotel Guests):
    • A pod is the smallest unit in Kubernetes, usually representing one or more containers (like Docker containers) that work together. Think of a pod as a group of guests sharing a room.

Control Plane Components

  1. API Server (Front Desk):
    • The API server is the main interface for Kubernetes. It’s like the front desk of the hotel where all requests come in. It processes requests and updates the state of the cluster.
  2. Etcd (Hotel Ledger):
    • Etcd is a key-value store that keeps track of the cluster’s state. It’s like the ledger book of the hotel where all the reservations and room statuses are recorded.
  3. Scheduler (Room Allocator):
    • The scheduler decides which node (room) will run a new pod (guest). It makes sure that the right resources are available and that everything is balanced.
  4. Controller Manager (Operations Manager):
    • The controller manager ensures that the desired state of the system matches the actual state. It’s like the operations manager who makes sure that all the tasks and services are running as planned.

Node Components

  1. Kubelet (Room Service):
    • The kubelet is an agent running on each node, ensuring that containers are running in a pod. It’s like room service that ensures all guests have what they need.
  2. Kube-proxy (Hotel Security):
    • Kube-proxy manages network communication inside the cluster, making sure that each pod can communicate with others. It’s like hotel security that ensures safe and efficient communication between rooms.
  3. Container Runtime (Room Utilities):
    • This is the software that runs the containers, such as Docker. It’s like the utilities in the hotel room (electricity, water) that make sure everything works.

How It Works Together

  • Deployment (Guest Check-In):
    • When you deploy an application, Kubernetes schedules pods on nodes based on resources and requirements. It’s like checking guests into the best available rooms.
  • Scaling (Adding More Guests):
    • Kubernetes can automatically scale your applications up or down based on demand, just like a hotel manager might open more rooms during a busy season.
  • Self-Healing (Maintenance):
    • If a container or node fails, Kubernetes automatically replaces or reschedules it, ensuring that your application keeps running. It’s like maintenance fixing a broken room immediately.

Summary

Kubernetes is a powerful system that automates the deployment, scaling, and management of applications. It does so by efficiently using resources and ensuring that applications run smoothly, much like a well-managed hotel ensures that guests have a pleasant stay.

 





 

 


No comments:

Post a Comment

  PROMETHEUS AND GRAFANA A robust performance monitoring and alerting stack is crucial to service reliability. Cloud Native Computing Foun...