Kubernetes Architecture Explained: Overview for DevOps Enthusiasts

Kubernetes is a relatively new technology that has simplified the management of containerized applications. It does this by automating the deployment, scaling, and management processes, ensuring that applications run smoothly and reliably.

In this article, we’ll explore how Kubernetes works, its architecture, and the role played by its different components. We’ll start by looking at a basic overview of the Kubernetes cluster architecture and then drill down into each component.

What is the purpose of Kubernetes?

Kubernetes is designed to help manage containerized applications by providing a platform for automating their deployment, scaling, and management. Its purpose is to allow developers and IT teams to focus on delivering value to their customers instead of worrying about infrastructure. By streamlining application deployment and management processes, Kubernetes helps organizations improve their agility and speed to market, ultimately delivering better products and services to their customers.

Many components work together to make this possible. Before we look at the main components, let us get an overview of its architecture.

Try the Kubernetes Familiarize Environment for free

Kubernetes Familiarize Environment for free
Kubernetes Familiarize Environment for free

An Overview of Kubernetes Architecture

We’ll use an analogy of a container-carrying ship to explain Kubernetes architecture. To look at the Kubernetes architecture from above, consider the picture below:

We have three cargo ships in the picture above. Each cargo ship has sections that carry containers across the sea and a control tower that is responsible for monitoring and managing the cargo ship.

The Kubernetes cluster consists of a set of nodes, which may be physical or virtual, on-premise or on the cloud, that host applications in the form of containers.

In our cargo ships analogy, you can think of ships as worker nodes. But somebody needs to load the containers on the ships and not just load, plan how to load, identify the right ships, store information about the ships, monitor and track the containers' locations, manage the whole loading process, etc.

This is done by the port control tower that hosts different offices and departments, monitoring equipment, communication equipment, cranes for moving containers between ships, etc.

In our analogy, you can think of the Kubernetes master node as the port control tower. The master node is responsible for managing the Kubernetes cluster storing information regarding the different nodes, planning which containers go where, monitoring the nodes and containers on them, etc. The master node does all of these using a set of components known as the control plane components.

Want to learn how to set up a Kubernetes cluster on your local machine? Check out this step-by-step guide: How to Setup a Kubernetes Cluster with Minikube & Kubeadm.

Try the Docker Familiarize Environment Lab for free

Docker Familiarize Environment Lab
Docker Familiarize Environment Lab

Kubernetes Control Plane Components

The Kubernetes control plane is essentially the brains behind the operation of a Kubernetes cluster. The control plane consists of several components, including the API server, etcd, scheduler, controllers, container runtime engine, and kubelet, which work together to ensure that the cluster functions properly and that applications are running smoothly.

Let’s now see the role of each of these components.

Looking to gain or polish your Kubernetes skills? Check out the following course from KodeKloud:
Kubernetes for the Absolute Beginners – Hands-on Tutorial | KodeKloud
Learn Kubernetes with simple, easy lectures and hands-on labs

ETCD

etcd is a distributed key-value store that is used in Kubernetes as a primary data store. It is responsible for storing configuration data and state information for the entire Kubernetes cluster. etcd is a reliable and secure way to store critical data and ensure high availability.

It is also designed to handle large data sets and offers strong consistency guarantees. It is a crucial component of Kubernetes architecture, and its reliability and scalability are essential for the smooth operation of Kubernetes clusters.

Schedulers

The scheduler identifies the right node to place a container on based on the containers’ resource requirements, the worker nodes' capacity, or any other policies or constraints, such as taints and tolerations or node affinity rules. It ensures that the cluster's resources are used efficiently and that workloads are distributed evenly across the nodes.

Controllers

Controllers in Kubernetes are components responsible for managing and maintaining a desired state of resources in the cluster. They monitor the state of resources and make necessary changes to ensure the resources match the desired state. This includes creating, updating, and deleting resources and objects as needed.

The node controller takes care of nodes. They’re responsible for onboarding new nodes to the cluster and handling situations where nodes become unavailable or get destroyed. The replication controller ensures that the desired number of containers are running at all times in your replication group.

Controllers work in conjunction with the scheduler to ensure that workloads are assigned to nodes and managed properly.

Kube API server

A Kube API server in Kubernetes is a key component that serves as the primary interface for managing the cluster. It provides a RESTful API that allows users to interact with the Kubernetes control plane and perform actions such as deploying and scaling applications, monitoring the cluster, and managing resources.

It is responsible for validating and processing incoming requests and communicating with other Kubernetes components such as the etcd datastore and the kubelet agents running on each node.

Container Runtime Engine

The container runtime engine in Kubernetes is responsible for managing the lifecycle of containers, including starting and stopping them. It is the component that actually runs the containers and provides the isolation between them. Examples of container runtime engines in Kubernetes include Docker, rocket, and Containerd.

Kubelet

A Kubelet is an agent that runs on each node in a cluster. It listens for instructions from the Kube API server and deploys or destroys containers on the nodes as required. The Kube API server periodically fetches status reports from the Kubelet to monitor the status of nodes and containers on them.

Kube-Proxy

Kube-proxy is a network proxy that runs on each node in a Kubernetes cluster. Its main function is to handle network routing for services in the cluster. It maintains network rules on the host system for forwarding traffic to the appropriate containers or services based on IP address and port number.

Conclusion

To summarise, we have the master and worker nodes. On the master, we have the etcd, which stores information about the cluster. We have a scheduler that is responsible for scheduling applications, containers, or nodes. We have different controllers that handle different functions like the node controller, replication controller, etc. We have a Kube API that serves as the primary interface for managing the cluster.

On the worker node, we have the Kubelet that listens for instructions from the Kube API server and manages containers. Lastly, the Kube-proxy enables communication between services within the cluster. That’s a high-level overview of the various components.


To learn about different Kubernetes concepts, watch this video.


More on Kubernetes: