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.
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 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
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:
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.
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 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. And 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.
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 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.
Why Learn Kubernetes
Kubernetes has witnessed the fastest growth in job searches, with a staggering increase of over 173% in just one year! According to recent surveys conducted by Indeed, the demand for Kubernetes skills is skyrocketing.
To boost your professional credibility, you can earn certifications like CKAD, CKA, and CKS, which will attest to your expertise in Kubernetes. The courses below will help you prepare for these three in-demand certifications.
- Certified Kubernetes Administrator (CKA)
- Certified Kubernetes Application Developer (CKAD)
- Certified Kubernetes Security Specialist (CKS)
Don’t know where to start your certification journey, check out the blog CKAD vs. CKA vs. CKS.
To learn more about the three certifications, check out our CKA, CKAD, CKS - Frequently Asked Questions blog.
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 or 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:
- What Are Pods in Kubernetes? A Quick Explanation (2023)
- Kubernetes Concepts Explained!
- 21 Popular Kubernetes Interview Questions and Answers
- 7 Best Kubernetes Books of All Time in 2023
- Kubernetes vs OpenShift: 5 Key Differences
- 6 Features of Kubernetes Every Beginner Must Know