Kubernetes Unveiled: Understanding Architecture and Witnessing Pod Creation!

Kubernetes Unveiled: Understanding Architecture and Witnessing Pod Creation!

Witness the Seamless Birth of a Pod in Action with an Exclusive Visual Demonstration!

Play this article

Welcome back fellow K8s explorers! In this blog, we are gonna unravel the inner workings of Kubernetes, but that’s not it! Not only will you gain a deep understanding of the K8s Architecture, but also you’ll witness the remarkable journey of how a pod comes into life within the cluster with a 40s video. Are you excited? 🤩 So let’s get started!

Kubernetes Architecture

The first thing that we should understand about Kubernetes is, that it is a distributed system. It has multiple components spread across different nodes in the cluster connected over a network.

A Kubernetes Cluster consists of two types of components:

  1. Control Plane Components - It is responsible for performing operations within the cluster and maintaining the cluster's desired state.

  2. Node Components - It is responsible for running the applications deployed in the cluster.

Control Plane Components

Control plane components are present in the master node(s) of the K8s cluster. They are used to operate the cluster and maintain it. Let’s take a look at the components of the control plane and understand the use of each of them.

Kube-API Server

The Kube-API Server is the core component of a Kubernetes Cluster, it exposes the Kubernetes API, serving as the entry point for all interactions within the cluster. It handles incoming API requests, user authentication and authorization, ensuring secure access to the cluster.

ETCD

ETCD is a distributed key-value store that is used by Kubernetes to maintain the data related to the cluster, it is also called as the single source of truth in the cluster.

ETCD stores all configurations, states, and data of Kubernetes objects (pods, deployments, secrets, config map, stateful sets, etc.)

Kube-Scheduler

The primary task of the Kube scheduler is to decide the placement of pods in the cluster. It takes into account the specifications of each node, its free resources, and the pod’s resource requirements before deciding on the placement.

Whenever a pod object is deployed in the cluster and you specify the resources needed for this pod such as (CPU, Memory, Node Selectors, Persistent Volumes, taints, tolerations etc.) in the YAML file. Kube-Scheduler reads those resource requirements and accordingly selects the best node to place the pod in using the selected scheduling algorithm.

Kube-Controller Manager

A controller is a program that runs in infinite controlled loops, watching over the state of the cluster and taking necessary steps to maintain the desired state of the cluster. It ensures that all Kubernetes objects in the cluster are in their desired state.

💡
In Kubernetes, controllers are control loops that watch the state of your cluster, and then make or request changes where needed. Each controller tries to move the current cluster state closer to the desired state.

Suppose we need to create a deployment of a Nginx image with 2 replicas, it is the job of the kube-controller manager’s deployment controller to ensure that the required number of replicas are present in the cluster. If we now update the number of replicas to 10 and deploy it, the controller will recognise the change in the desired state and ensure the desired state is maintained by requesting to create more pods.

The controller manager consists of many inbuilt controllers which manage the Kubernetes objects, some of them are:

  1. Deployment Controller

  2. Replicaset Controller

  3. DaemonSet Controller

  4. Job Controller

  5. CronJob Controller

  6. Endpoints Controller

  7. Node Controller

Node Components

Node components are present in every node of the cluster irrespective of whether the node is a master node or a worker node. Let’s take a look at the node components and understand their use.

Container Runtime

A container runtime is the essential engine responsible for executing containerised apps in a Kubernetes node. It is the software that converts container images into actual processes. Container runtimes handle container lifecycle operations such as generating, initiating, stopping, and deleting containers. Kubernetes is intended to be container runtime agnostic, which means it may work with a variety of runtimes such as containerd, CRI-O and others. This adaptability is enabled by the adoption of the CRI (Container Runtime Interface), which enables container runtime software to make themselves compatible with Kubernetes.

Kubelet

We can think of Kubelet as an agent that runs as a daemon, managed by systemd. It is responsible for:

  • Creating, modifying, and deleting containers for the pod in the node by communicating with the CRI (Container Runtime Interface) used in the node.

  • Handling the liveliness, readiness, and the startup probes

  • Communicating with the master node’s API Server, sharing the report of the pods in the node and their statuses

Kube-Proxy

Kube-proxy is a fundamental component of a Kubernetes node that manages network communications. Its key role is to manage network rules that allow different pods and services to communicate with one another. It guarantees that requests are sent to the correct destination, whether that be another pod on the same node or one elsewhere in the cluster. Kube-proxy facilitates seamless and reliable communication among the many components inside a Kubernetes cluster by handling load balancing, service discovery, and network address translation (NAT).

Witnessing Kubernetes in Action: The Birth of a Pod 🤩

Now that we have a firm grasp on the major components that comprise the Kubernetes architecture, it's time to put it all together. In this video, we'll take you on a captivating 40-second journey around the Kubernetes cluster, demonstrating how a pod comes into being. This visual representation will provide you with a clear, step-by-step understanding of Kubernetes' inner workings. Prepare to see the magic unfold!

Congratulations on reaching till the end of this blog!

We took a tour of Kubernetes, learning about its architecture and internal operations. However, seeing is believing! You saw a pod come to life inside Kubernetes in the 40-second video. It's almost like magic!

This video will help you understand Kubernetes even more. You're now ready to go deeper into the fascinating realm of container orchestration. 🥳

Thank you for joining us on this journey. There's so much more to learn about Kubernetes, Keep learning together, and feel free to like and comment on my blog with your thoughts. Don't forget to follow me on LinkedIn for more exciting updates!