Skip to main content

Command Palette

Search for a command to run...

Introduction to Kubernetes and its Architecture

Kubernetes Unveiled: A Deeper Look into Container Orchestration

Published
4 min read
Introduction to Kubernetes and its Architecture
Y

I am a passionate mobile developer from Haridwar

The current industry norm for container orchestration has been established by Kubernetes. Understanding Kubernetes and its design is crucial whether you're a developer, a system administrator, or simply someone interested in the realm of DevOps. This blog article will provide you with a thorough introduction to Kubernetes, outlining its core ideas and architecture.

What is Kubernetes?

Kubernetes, often abbreviated as K8s, is an open-source container orchestration platform. It was originally developed by Google but is now maintained by the Cloud Native Computing Foundation (CNCF). Kubernetes serves as a powerful tool for automating the deployment, scaling, and management of containerized applications.

Kubernetes helps in solving various problems that arise while using docker containers. To understand the workings and architecture of Kubernetes, you must know what are containers and how to dockerize a container.

Pod

A Pod is the smallest deployable unit in Kubernetes. It can contain one or more containers that share the same network namespace and storage. You can think of pods as a wrapper over the container that has some advanced capabilities.

Nodes

Nodes are the physical or virtual machines in a Kubernetes cluster where Pods run. Nodes are responsible for running containers and providing the necessary runtime environment. We will discuss it in the architecture of K8s.

4 major problems are solved by Kubernetes that are:-

  1. Single Host- Docker acts as the single host for all the containers. This creates a problem when the load on any container increases which affects other containers too. To counter this K8s uses Cluster. A cluster is a group of nodes that contains the control plane and worker nodes (refer to the architecture of K8s to read in detail). It can put pods in different nodes so that any faulty pod does not affect other pods.

  2. Auto Scaling- Docker does not have any feature that handles the traffic on the containers. K8s has a replica set (replication controller). In the project file, we can make changes to deployment.yaml or replicaset.yaml file to increase the number of Pod replicas running. We can also use Horizontal Pod Autoscaler(HPA) which handles the auto scaling in K8s.

  3. Auto Healing- Kubernetes can control and heal the damage. If a pod goes down, Kubernetes starts another container immediately before the pod goes down (refer to the architecture of K8s to read in detail).

  4. Enterprise Level Support- Docker is never used in production, instead Docker Swamp is used widely at the enterprise level. Kubernetes with the help of other projects in CNCF like Prometheus, Grafana, etc. are used at the production level helping the community to grow day by day.


Architecture of Kubernetes

A Kubernetes cluster consists of a control plane/master node and worker nodes. Let's see what a worker node has inside.

Worker Node

A worker node consists of mainly 3 types of components:-

  1. Kubelet- It is responsible for maintaining pods. It ensures that the containers are always running in a Pod. It communicates with the control plane to manage the Pod's lifecycle.

  2. Kube Proxy- It is responsible for providing network communication between Pods. It maintains network rules on nodes and performs packet forwarding.

  3. Container Runtime- The container runtime, such as Docker, containerd or cri-o, is responsible for running containers on the node.

    Now moving onto the control plane.

Control Plane

The control plane is the brain of the Kubernetes cluster. It is responsible for making decisions about the cluster as well as detecting and responding to cluster events. The major components of a control plane are:-

  1. API Server- The API server is the entry point for all REST commands used to interact with the Kubernetes cluster. It serves as the front end for the Kubernetes control plane. It decides which pod should go in which node and also receives error messages from Kubelet if any pod goes down or stops running, thereby solving the problem of auto healing.

  2. etcd- It is a distributed key-value store that stores the configuration data of the cluster. It is used to store information about Pods, Services, ConfigMaps, and more. It acts as the backup service which can be useful when we have to restore the cluster.

  3. Controller Manager- The controller manager is responsible for running controller processes that regulate the state of the system. It includes controllers like the Replication Controller, which ensures the desired number of Pod replicas are running.

  4. Scheduler- The scheduler is responsible for placing Pods on available nodes. It takes into account factors like resource requirements, node capacity, and affinity/anti-affinity rules when making scheduling decisions. The Scheduler receives the information from the API Server.

  5. CCM (Cloud Controller Manager)- It manages interactions between a K8s cluster and the cloud provider's infrastructure. The CCM is responsible for tasks like creating load balancers, managing storage, and integrating with cloud-specific features while keeping Kubernetes itself cloud-agnostic. This component does not have to be created if we are using it on-premise.

Thats it for this blog, thank you for reading.