Architecture Of Kubernetes
Tags: kubernetes, docker, programming, cloud
Published: 2022-09-25 05:08:41

## Prerequisites

1. Basic Understanding of Cloud.
2. Basic Understanding of Docker.

## Kubernetes

- Kubernetes is the Container Management Orchestration Tool which is developed by Google for managing their own microservices across the different clusters.

- Kubernetes also called K8s, basically is Numeronym Standard which is used since the 1980s. For Example, In the K8s there are 8 words in between K and S like that.

- Google developed an internal system called Borg and later on, named Omega which they use to Orchestrate the Data Center.

- In 2014, Google introduced Kubernetes as an Open Source and it is written in Golang language. Later on, donated to CNCF.

- Kubernetes is a tool that automates container deployment, load balancing, and auto-scaling. It will manage all the containers which are running in different environments.

## Feature of Kubernetes

- _Orchestration Support:_ Kubernetes provides a cluster to manage multiple containers which are running in different environments.

- _Auto Scale Application:_ It will auto-scale the application as per our requirements and network traffic.

- _Automate the Deployment:_ Using Kubernetes, we automate our deployment process using different cloud provider services.

- _Fault Tolerance:_ It will manage all the things related to the container, suppose our container is running under different nodes and pods and Kubernetes found one of the pods, and the container stops working then it will manage incoming network traffic.

- _Load Balancing:_ It will balance a load of our application using different nodes and pods which are in running mode.

- _Platform Independent:_ It will manage all types of applications that are running under a different environments like virtual, cloud, and physical machines.

- _Health Monitoring:_ It will manage the health of containers that are running under different types of pods.

- _Rollback:_ We are also able to roll back the application version using Kubernetes.

- Batch Execution: We are also able to execute some functionality simultaneously and parallelly.

## The Architecture of Kubernetes

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b19ludwfpc292idu1reh.png)

There are two nodes which is used by Kubernetes while running the application, which will see one by one.

## Kubernetes Master Node

- The Master is responsible for managing the complete cluster.
- It has four components like ETCD, API Server, Scheduler, and Controller Manager.
- Users can able to access Master using CLI and API Server.
- Master continuously watches all the nodes under the cluster and takes the action.
- There can be more than one Master Node present to reduce the Fault Tolerance on high availability.

Following are the components of the Master Node,

**API Server**

The Master can communicate with all the clusters through API Server. It is the main access point of the control plane.
The API Server directly interacts with the user. Ex- user able to apply YML or JSON file directly to the API Server.
API Server has the capability to auto-scale as per the load.
API Server is the front end of the control plane.

**ETCD**

- ETCD is used to store data as key-value pairs which are used by Kubernetes to manage the clusters.
- It also stores the metadata and the status of the cluster.
- ETCD is the consistent and high availability data store.
- It is also responsible to maintain the lock mechanism to reduce to the conflicts between the Masters.
- When we have multiple Masters and Nodes then ETCD stores all the data in a distributed manner.

ETCD has the following features,

_Fully replicated:_ The entire state of the data is available on every node which is present in the cluster.
_Secure:_ It also implements automatic client TLS certificate authentication.
_Fast:_ ETCD is also very fast and easily performed multiple operations in seconds.

**Scheduler**

- The scheduler is responsible for distributing the work across multiple different available nodes.
- It always looks at newly created containers and assigns the node.
- Handles Pods creation and management.
- When the user makes the request for the creation and management of pods the scheduler will take the action against that request smoothly.

**Controller Manager**

- Controllers are the main thing behind the orchestration.
- Controllers continuously look and watch the health of the node like it responding or not and take actions according to it.
- It also manages the state of the controller related to deployment, replica, and no of nodes running in the cluster.

It has the following two choices,

- If Kubernetes is on the cloud, then it will be the cloud controller manager.
- If Kubernetes is not on the cloud then it will be the Kube-controller manager.

Also, there are the following different components that are present in the master

_Route Controller:_ Responsible for managing the networking.
_Node Controller:_ Responsible for detecting the node if not responding.
_Service Controller:_ Responsible for Load Balancing to manage the load.
_Volume Controller:_ Responsible for mounting and creating volume storage.

## Kubernetes Worker Node

There are the following components that are present in the Worker Node.

**Kubelet**

- Kubernetes Worker Node has Kubelet to communicate with Master Node and provide all information continuously to the Master Node related to Health of Nodes
- It is also responsible to carry out the action taken by Master Node.
- Listens to Kubernetes Master.
- It also sends access reports of the node to the master.

**Kube-Proxy**

- Kube-Proxy is responsible for managing the network traffic properly or not as per the rule defined in the controller manager,
- It also assigns the IP Addresses to each pod.
- Kube-Proxy runs on each node and it has the responsibility to check that the unique IP Address is assigned to each pod.

**Pods**

- Pods are the smallest deployable unit in Kubernetes.
- It runs as a single instance of the application.
- It may have many resources like IP Addresses, Containers, and Storage.
- Pods have one or more containers that are deployed under the same host.
- In Kubernetes, the control unit is a pod, not the container.
- It also has one more tightly coupled Container in one pod sharing resources with each other.
- Pods run on the worker node which is controlled by the master.
- Usually, one pod contains one container, and without a port, Kubernetes is not able to run the container because Kubernetes only knows Pods not Containers.

**Multi-Container Pods**

- It is also possible in Kubernetes to have multi-container pods in that case they have share access to resources.
- They are able to connect with each other using the IP Address of the container.
- Containers deployed within pods are all and nothing manner.
- Also, if Pod crashes and stops responding then all the containers within that also do not work.
- Higher Level of Kubernetes Objects

**Replica Set**

It maintains the state of the pod replicas and availability of required pods

**Deployment**

It Manages the Versioning of applications and Rollback if needed.

**Volume**

Kubernetes provide stable storage services in the form of volume it persists data whole lifetime of the pods.

**Service**

In Kubernetes Node there are multiple pods in running mode under selector, so in that case, the service manages DNS and Addresses for that.

So, this is all about Architecture and the working of Kubernetes, I Hope you understand things related to Kubernetes.

Happy Coding!