Kubernetes Architectural Overview
Tags: kubernetes, docker, devops, beginners
Published: 2023-06-25 17:49:18

Kubernetes is a popular open-source platform used to manage containerized applications. It provides a flexible and scalable way to deploy, manage, and automate containerized workloads. A Kubernetes cluster consists of a control plane and worker nodes.

![K8s Architectural Overview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyroo29ck9gzzpd44o3u.png)

## Control Plane
The Kubernetes control plane is composed of several components that are responsible for overseeing and managing the cluster on a global scale. Its main function is to govern the operations of the entire cluster. While the control plane components can be deployed on any machine within the cluster, it is common practice to run them on dedicated controller machines.

![K8s Architecture - Control Plane](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ial0ubcjc16cc4rrpump.png)

- The **kube-api-server** fulfills the role of serving the Kubernetes API, which serves as the primary interface for interacting with the control plane and the cluster as a whole. When you interact with your Kubernetes cluster, you will typically do so through the Kubernetes API.
- **Etcd** serves as the underlying data storage for the Kubernetes cluster, functioning as a reliable and highly available storage solution for all cluster-related data. It is responsible for storing and maintaining the cluster's state information.
- The **kube-scheduler** is responsible for the task of scheduling, which involves the selection of an appropriate node within the cluster for running containers. It ensures that containers are allocated to available nodes based on factors such as resource requirements and availability, optimizing the distribution of workloads across the cluster.
- The **kube-controller-manager** consolidates multiple controller utilities into a single process. These controllers perform various automated tasks within the cluster, facilitating efficient management and operation. By running multiple controllers within a unified framework, the kube-controller-manager streamlines the execution of these automation tasks in a cohesive manner.
- The **cloud-controller-manager** serves as a bridge between Kubernetes and diverse cloud platforms, facilitating seamless integration and management of cloud resources within the Kubernetes environment. This component is utilized specifically when leveraging cloud-based resources alongside Kubernetes, enabling efficient utilization of cloud services in conjunction with Kubernetes capabilities.

The control plane components can be deployed on either a single server or multiple servers, depending on the desired configuration. In order to achieve high availability for the cluster, it is recommended to run these components on multiple servers. This ensures redundancy and fault tolerance, enhancing the overall resilience of the cluster.

## Worker nodes
Kubernetes nodes serve as the execution environment for containers managed by the cluster. A cluster can comprise any number of nodes, each responsible for hosting and managing containers. The nodes consist of multiple components that oversee container operations on the machine and establish communication with the control plane. These components ensure proper orchestration and coordination of containers within the cluster.

![K8s architecture - worker node](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9t1732cc2v93a0nqk99.png)

- The **kubelet** acts as the Kubernetes agent deployed on every node within the cluster. It establishes communication with the control plane and ensures the execution of containers on its respective node, following instructions provided by the control plane. Additionally, the kubelet is responsible for reporting container status and transmitting relevant data pertaining to containers back to the control plane.
- The **kube-proxy** serves as a network proxy within the Kubernetes cluster. It runs on each node, and takes on specific responsibilities associated with facilitating networking between containers and services.
- The **container runtime** is an independent software component that Kubernetes relies on to execute containers on the underlying machine. It is not inherently integrated into Kubernetes itself. Instead, Kubernetes supports multiple implementations of container runtimes. These runtime implementations are responsible for the actual execution and management of containers.

In conclusion, Kubernetes architecture consists of a robust control plane comprising various components such as kube-api-server, kube-scheduler, kube-controller-manager, and cloud-controller-manager. These components work together to manage the cluster, schedule containers, handle automation tasks, and interface with cloud platforms. On the worker nodes, kubelet and kube-proxy play essential roles in managing and executing containers while ensuring seamless networking. This distributed architecture enables the efficient orchestration and scalability of containerized applications in Kubernetes clusters.