Architecture of Kubernetes
This article will discuss all about the Architecture and the working of Kubernetes, and you will understand things related to Kubernetes.
Join the DZone community and get the full member experience.Join For Free
We are going to discuss things related to Kubernetes architecture in this blog.
- Basic Understanding of Cloud.
- Basic Understanding of Docker.
- Kubernetes is the Container Management Orchestration Tool which Google develops for managing their own microservices across the different clusters.
- Kubernetes, also called K8s, basically is Numeronym Standard that 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 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 environment 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
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: 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 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,
- 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 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.
- 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.
- Controllers are the main thing behind the orchestration.
- Controllers continuously look and watch the health of the node, like it is 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, 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.
- 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 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 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.
- It is also possible in Kubernetes to have multi-container pods. In that case, they have shared 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
It maintains the state of the pod replicas and the availability of required pods.
It Manages the Versioning of applications and Rollback if needed.
Kubernetes provide stable storage services in the form of volume. It persists data whole lifetime of the pods.
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.
Published at DZone with permission of Jaydeep Patil. See the original article here.
Opinions expressed by DZone contributors are their own.