Kubernetes Architecture

Kubernetes Architecture

If you are in the DevOps ecosystem, learning Kubernetes is very important.

Having a good understanding of the architecture of Kubernetes will make it easier for you to understand the working of Kubernetes.

Mainly we have three components to discuss: cluster, control plane and worker node. We also have sub-components which we will discuss in this blog itself.

Cluster

In the context of Kubernetes, a cluster consists of master and worker nodes that collaborate to manage and orchestrate containers and applications.

kubectl is the command line tool that we use to interact with the cluster.

Control Plane

A collection of various components that help us in managing the overall health of the cluster. Anything that happens will be managed by the control plane.

Let us look into the components of the control plane.

  1. API server: All the communications will happen via the API server. Whenever we give a command through kubectl, this command goes to the API server.

    Now, the API server will do three things:

    1. Authentication

    2. Authorization

    3. Admission

  2. Scheduler: It is a very intelligent component in Kubernetes. It will find the best-fit node to run your pod.

  3. etcd: It's a database that stores information about the cluster.

    NOTE: API server only talks to etcd, rest all the other components talk to the API server.

  4. Controller manager: It controls the different Kubernetes objects. It makes sure that the desired state is the same as the actual state. It controls various controllers like deployment controller, replicaset controller, etc. If there is any issue it talks to the API server.

Worker Node

A worker node, also known as a minion, is responsible for running containers. It executes tasks assigned by the cluster's control plane and manages the execution of containers using tools like Docker or other container runtimes.

Let us look into its components one by one.

  1. kubelet: It's on every worker node. So, whenever a new worker node is created and attached to the control plane, the kubelet is installed on that. Its job is to listen to the API server. kubelet will talk to containerd to fetch the image from the registry.

  2. kube-proxy: It is responsible for networking. It maintains the network rules on nodes. These rules allow network communication to your pod from network sessions inside or outside of your cluster. It maintains a list of iptables or ipvs.

  3. Container runtime: The container runtime is the software that is responsible for running containers. Kubernetes supports container runtimes such as containerd.

    Our pod is inside the container runtime and inside the pod our application runs.

  4. CNI: Stands for Container Network Interface. It is the networking component in Kubernetes.

  5. CSI: Stands for Container Storage Interface. It is the storage component.

So, the request was sent by kubectl to the API server, then to the scheduler, then to kubelet, then kubelet talked to containerd, then containerd used CNI to attach all networking stuff, kube-proxy updated the iptables and now the pod started running.

That was all about basic Kubernetes Architecture.

If you want to know more about Kubernetes architecture and gain more knowledge of various components, then check out the docs here.

What's next?

I will share all my learnings related to Kubernetes in this series. So stay tuned for more blogs.

I post regular stuff related to DevOps, CNCF, Open source, Golang and Cloud.

Connect with me on socials.