A Deep Dive Into Kubernetes Architecture

Master Node:-

  • It is the main component of kubernetes which is responsible for managing the whole cluster. It manages the the worker nodes connected to the cluster, stores the information about worker nodes. Master node is responsible and track which pod is assigned to which node.

  • Also it checks the health of worker nodes so that in case a worker node goes down it re-assign the running pods to a healthy node. Mater node use the control plane components to store information, continous health checks, monitiring the scheduling pods to a particular node etc.

Kube Api Server:- it expose the kubernetes api to external users to perform operation & it manage the cluster at high level also help the worker node to communicate to the server. Also kube api server fetches report from kubelet to monitor the status of worker nodes & containers. It handles the authentication, authorization part of kuberentes cluster. It check for the client certificate/tokens for authentication, RBAC(role based access control) for authorization.

Controller manager:- Take an example of AC where you have set a Desired temperature but the actual temperature is different. Same goes with the controllers in the kubernetes. It maintains the current status equal to desired state.It Checks the status of nodes through kube api-server replicate and create new pod if a pod die to maintain the desired state.

Kube-Scheduler:- It is responsible for scheduling the pods on the worker nodes. It checks on the basis any labels, taints tolerations applied and based on that it schedule a particular pod on a particular node. Also it identify the right node based on the resource utilization of nodes and assign pod to that node which is having low resource or memory utilization.

Etcd:- It is a consistent & highly available key value storing option for storing the all data of kubernetes clusters. it store information about number of nodes, number of pods, config maps, secrets, roles etc. By default the etcd listen on port 2379.

Worker Node:-

Let suppose a construction company represents the Kubernetes cluster itself, managed by the control plane components (API server, Controller Manager, etc.).

Now the actual work happen at the construction site which can be related to a worker node. So the worker nodes are basically virtual machines which running on cloud, on-prem server etc. They utilize the underlines resources of server to run the application.

Kubelet:- Kubelet is an agent which is responsible for interacting with kube api-server at master node & the worker node. It run on each node & listen the kube api-server to deploy/destroy containers

Kube-Proxy:- Let's suppose of mailroom clerk in a company whose task is to distribute the right mail to right employee. Same in kubernetes the kube proxy is responsible for directing incoming and outgoing network traffic to the right pods in the cluster.

Container Runtime:- It is engine that executes and manages the lifecycle of containers, including starting, stopping etc containers. Kubernetes itself is not a container runtime; instead, it interacts with different container runtimes to manage containers. The most popular container runtime is Docker. There are others too like contaienrd, CRI-O, Rockets etc.

Pods & Containers:- It is the smallest entity in the kubernetes cluster. The application in form of container are encapsulated into the kubernetes object called as pod. It is a single instance of a application.

Let's suppose a delivery system where the packages are being delivered by the delivery van. Now the packages can be considered a container which holds the application code, dependency etc for an specific application. On the other hand the Pod can be considered as a delivery van. It can carry one or more packages (containers) and provides an environment for these packages to work together.

Kubectl:- It is a command line utility through which we can communicate or instruct the Kubernetes cluster to carry out certain task.

So all these components provides many functionalities to kubernetes. Like self healing feature if a pod die, creates a new pod to keep application running. Using rollback it is very easy to switch back to previous version of application. With load balancing & autoscaling capabilities kubernetes can handle traffic by creating more pods.