Unlocking the mysteries of Kubernetes Cluster Architecture

📍Prerequisites

Well before we begin with this blog on Kubernetes, you should atleast know what Containers are, that according to me is an essential prerequisite cause if you're learning about a Container Orchestration tool like Kubernetes and don't have a good understanding of Containers then that doesn't really make sense now does it?

Also don't fret if you don't know where to learn about Containers and all cause I have a dedicated Blog on Docker that covers all these essential topics, you can first give that one read and then come back to this.


Also, one last thing before we begin, if you don't like reading blogs and rather watch a video explaining all these concepts then fear not cause I have a YouTube video up on my channel on this very same topic that you can check out 🚀.


📍What exactly is Kubernetes?

Well Kubernetes is a "container-orchestration tool" and was created by Google in 2014, In simple terms, it makes it easier for us to manage containers by automating various tasks. As a matter of fact, K8s first created solely to help Docker. Docker was created way before Kubernetes or K8s was created, then K8s was created solely to orchestrate Docker but as K8s became popular other container runtimes such as rkt wanted to get involved.


📍Why should we use Kubernetes in the first place?

Well okay I get your point you're reluctant on using Kubernetes, I would be too so let's take two scenario.
SCENARIO 1
So if you read my blog on Docker, then you must remember the Post Office example I gave to make you all understand what all Containers are. So now that we have our envelope ready with whatever application coded with any language. So now its the job of Post Office to deliver our envelope or container in a timely, effective and efficient manner to our destination right? Well while delivering our envelope there might be some cases such as flight got delayed or delivery partner faced some traffic while delivering but we don't care about all those scenarios all we want is that my family and friends receive the envelope timely. Well the Post Office in this case is Kubernetes. Kubernetes makes it easier for us to manage containers and ensure that there is no downtime.

SCENARIO 2
Imagine a scenario where one of the containers in your operation experiences a shutdown. Restarting it manually is a simple task. However, envision a situation where a multitude of containers face downtime. Wouldn't it be more convenient to have the system address this issue automatically? Kubernetes can manage such situations effortlessly. It offers various features, including scheduling, scaling, load balancing, fault tolerance, deployment, automated rollouts, rollbacks, and more.

So I hope you have got a pretty good idea on why we need Kubernetes.


📍Let's talk about Kubernetes Architecture now!

A master node in the Kubernetes architecture oversees other worker nodes. Worker nodes are nothing more than physical servers or virtual machines that operate in data centers. They make the application's storage and network resources visible to it. Together, these nodes create a cluster that offers replication and fault tolerance.

Master Node (Control Plane)

Let’s deep dive into Master Node:
In master node we have etcd cluster, kube-apiserver, Kube controller manager and kube-scheduler:

  • ETCD cluster: contains the info about the cluster.

  • kube-scheduler: which is responsible for scheduling applications or containers on nodes.

  • kube controller manager:

Kube Controller Manager is responsible for monitoring the state of the cluster and making necessary changes to ensure that the desired state is maintained. It includes controllers for nodes, endpoints, replication, and more. This ensures that the cluster is always running optimally and efficiently. It contains processes like node controller and replication controller.

  • kube-api server:

kube-api server acts like a gateway to K8s cluster. It receives requests from kubectl CLI tool or dashboard and communicates with etcd cluster to handle these requests. It also validates and authorizes these requests before processing them (basically orchestrates every action that take place in the cluster)

Worker Node

Let’s deep dive into Worker Node:

In worker nodes we have our kubelet, kube-proxy, pods and containers:

  • kubelet: listens to the instructions from the kube-api server and manages our containers.

  • kube-proxy: enables communication between the services within the cluster.

  • pods:
    A pod in Kubernetes (K8s) is the smallest and most basic unit of deployment. It represents a single instance of a running process in the cluster. A pod can contain one or more containers that share the same network and storage resources. Containers within a pod can communicate with each other using localhost, making it easier to manage and maintain dependencies between the containers. Pods are managed and scheduled by the K8s cluster, and they can be scaled horizontally to handle increased workload or traffic.


📍Installation of Kubernetes

  • kubectl

The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For more information including a complete list of kubectl operations, see the kubectl reference documentation.

  • kind

kind lets you run Kubernetes on your local computer. This tool requires that you have either Docker or Podman installed. The kind Quick Start page shows you what you need to do to get up and running with kind.

  • minikube

Like kind, minikube is a tool that lets you run Kubernetes locally. minikube runs an all-in-one or a multi-node local Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work. You can follow the official Get Started! guide if your focus is on getting the tool installed.

  • kubeadm

You can use the kubeadm tool to create and manage Kubernetes clusters. It performs the actions necessary to get a minimum viable, secure cluster up and running in a user friendly way. Installing kubeadm shows you how to install kubeadm. Once installed, you can use it to create a cluster.


📍Conclusion

In summary, Kubernetes, or K8s, is a powerful container orchestration platform essential for modern application management. Our exploration of its architecture, master and worker nodes, and installation process reveals a robust framework for automating and scaling containerized applications. With components like the kube api server and etcd cluster, Kubernetes streamlines deployment, making it a cornerstone in the realm of contemporary software development. Whether you're a seasoned DevOps professional or a newcomer, understanding Kubernetes is key to navigating the dynamic landscape of container orchestration. And I hope this blog helped you achieve that very same goal and gave you a bit of insight into what K8s is all about.
Well that's all for now but we'll meet again soon in our next blog.
Till then you can follow me on LinkedIn and Twitter.

12
Subscribe to my newsletter

Read articles from Shivang Shandilya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shivang Shandilya
Shivang Shandilya

DevOps and Open Source