Saturday, March 30, 2024

Kubernetes Architecture

Kubernetes Architecture

Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications. It is designed by Google and now being maintained by CNCF.

Kubernetes Architecture can be divided into two components.

1. Master Node Components:

The Master Node (also referred to as the Control Plane) is responsible for managing the cluster. It coordinates and schedules tasks, maintains cluster state, and monitors node health.

Key Components:

-API Server (kube-apiserver): Configures and validates data for api objects like pods, services. Its a front-end of control plane.

-Scheduler (kube-scheduler): It decides where in the cluster the workloads are to be run.

-Controller Manager (kube-controller-manager): Runs controller processes, managing the core Kubernetes loops that regulate the cluster state.

-etcd: A highly available key-value store used as Kubernetes to stores all cluster-related data.




2. Worker Node Components:

Worker Nodes (sometimes simply called Nodes) are the machines that run your application containers. Nodes are physical or virtual machines that can run pods as part of a Kubernetes cluster. A cluster can scale up to 5000 nodes. To scale a cluster’s capacity, you can add more nodes.

Key Components:

-Kubelet: Primary node agent which performs various tasks like mounting volumes, running containers, etc. for pods assigned to the node

-Kube-Proxy (kube-proxy): Maintains network rules on nodes, enabling network communication to Pods from network sessions inside or outside of the cluster.

-Docker: Container engines for running containers

-cAdvisor: Provides container users an understanding of the resource usage and performance characteristics of their running containers

-Pods: The smallest deployable units created and managed by Kubernetes, which can contain one or more containers.




The Master Node and Worker Nodes work together in a Kubernetes cluster to automate the deployment, scaling, and operations of application containers. The Master Node makes decisions about the cluster, while the Worker Nodes execute those decisions and run the application containers.


3. Additional Components:

-CoreDNS: Provides DNS services to the Kubernetes cluster, enabling pods to locate each other by name.

-Dashboard (optional): A web-based Kubernetes user interface.


Different types of control manager in Kubernetes architecture?

In Kubernetes, the Controller Manager is a component of the Master Node (Control Plane) that runs various controller processes. These controllers are background threads that handle the state of the cluster, such as ensuring the correct number of pods are running for a given deployment or managing the state of other resources. 

Types of controller processes(10).

1. Node Controller

Function: Responsible for noticing and responding when nodes go down. It ensures that when nodes become unavailable, the pods running on those nodes are moved to healthy nodes.

2. Replication Controller

Function: Ensures that the specified number of pod replicas are running at any given time. If there are too many pods, it will terminate the extra ones. If there are too few, the Replication Controller will start more.

3. ReplicaSet Controller

Function: The next-generation Replication Controller that supports a more expressive pod selection criterion. It ensures that a specified number of pod replicas are running at all times.

4. Deployment Controller

Function: Manages the deployment of replicasets and provides updates to the application’s pods along with a lot of other useful functionality.

5. StatefulSet Controller

Function: Provides unique identities to pods and persistent storage across pod rescheduling, ideal for stateful applications like databases.

6. DaemonSet Controller

Function: Ensures that all (or some) nodes run a copy of a pod. As nodes are added to the cluster, pods are added to them. As nodes are removed from the cluster, those pods are garbage collected.

7. Job Controller

Function: Watches for Job objects that represent one-off tasks, then creates Pods to run those tasks to completion.

8. Endpoints Controller

Function: Populates the Endpoints object (that is, joins Services & Pods).

9. Service Account & Token Controllers

Function: Create default accounts and API access tokens for new namespaces.

10. Garbage Collector Controller

Function: Responsible for cleaning up various resources like finished Jobs, deleted Pods, and objects without owners.

These controllers are essential for the self-healing mechanism of Kubernetes, as they automatically manage the lifecycle and state of various resources within the cluster. The Kubernetes Controller Manager is designed to bundle these control loops logically, running them in a single process to simplify management operations.


KUBERNETIS ARCHITECTURE






No comments:

Post a Comment