What is Kubernetes?

Anshuman Pattnaik
6 min readSep 4, 2022

Introduction

Kubernetes is a container orchestration platform used to automate the process of cloud-native software deployment, scaling and management system. Kubernetes was initially developed and designed by Google and released as open-source software in 2014; now, the project is maintained by Cloud Native Computing Foundation.

The technology behind Kubernetes is Docker, Containerd and CRI-O, and in the early period, it only interacted with Docker through Dockershim. However, from the year 2016 up to April 2022, Kubernetes deprecated shim used containerd to interact with the container directly and replaced Docker with a runtime compliant with the Container Runtime Interface. And the primary advantage of using Kubernetes, it distributes the application operational tasks across the Kubernetes cluster and monitors the container pods for resource utilization, including memory, CPU and storage. And also, to run these container pods efficiently, Kubernetes allocates storage and dynamically provisions persistent volumes to running containers and enables auto-scaling to deal with fault tolerance and continuously maintain the application state.

How does Kubernetes work?

The architecture behind Kubernetes is to run containerized applications, and each operational deployment is called a cluster. Each cluster consists of two parts — the control plane and compute machines. And in every Kubernetes cluster, there will be at least one node, and each node runs pods which are nothing but containers, and every node runs its own Linux environment, either physical or virtual machine. The Kubernetes Pods are the minor deployable units that run one or more containers, and all these pods run on worker nodes.

The control plane is responsible for managing the worker node and pods in the cluster so that it can monitor which applications are running on which container. It also manages and responds to cluster events for fault tolerance. And Compute machines are responsible for running the applications within a cluster.

Kubernetes Control Plane Components

Four components are used by the control plane to manage nodes, control communications and track the state of the Kubernetes cluster.

kube-apiserver

kube-apiserver exposes Kubernetes API, and the API server validates and configures data for the API objects, including pods, services, replication controllers and others.

etcd

etcd is an open source distributed key-value store, and it’s used to store data and its configurations safe that later need to be accessible by a distributed system or cluster of machines.

kube-scheduler

kube-scheduler is a control plane process that assigns Pods to Nodes, and the scheduler decides which Nodes are valid replacements for Pods based on resources and policies.

kube-controller-manager

kube-controller-manager is a daemon that manages various controllers in Kubernetes; these Controllers are nothing but control loops, and their job is to watch the state of the cluster continuously and make a change whenever required. The controller always tries to move the cluster state to the desired state.

Kubernetes Node Components

Three major Kubernetes components are associated with the nodes, and we will discuss all three components one by one.

Kubelet

Kubelet is an agent that runs on each node, and its job is registering a node with the apiserver using the hostname. And also kubelet agent checks the containers’ status in a Kubernetes Pod.

Kube-proxy

Kube-proxy is a network proxy that runs on each node in a Kubernetes cluster. To communicate with the Pods, kubelet-proxy maintains a network rule on each node that allows network communication to the Pods from network sessions inside or outside the clusters.

Container Runtime

Container runtime is a low-level component in the container engine, and it’s responsible to mounts the container and working with the OS kernel to start & support the containerization process.

What is the need of Kubernetes?

Containerization is the best technique to bundle software code with all the necessary components, such as libraries, frameworks and
dependencies, and isolate them in their container to run the application. But in a production environment, we need to manage these containers and maintain the container state so that the application will run smoothly without any downtime, let’s say in a live production environment, if a container goes down, then immediately another container should start to continue running the application, and that’s where Kubernetes comes to automate this process.

Service discovery and load balancing

Kubernetes exposes a container with its DNS name or using its IP address. Kubernetes can load balance and distribute the network traffic to control the traffic to a container to stabilize the deployment.

Storage Orchestration

In the Kubernetes world, it allows users to automatically mount a storage system of their choice, such as local storage, public cloud providers, etc.

Automated rollouts and rollbacks

Kubernetes can describe the desired state of a deployed container and change the actual state to the desired state of a running container. For example — In case of any error in a live production environment, it can roll back to the previous version. And to roll out a new container, you can automate the process using Kubernetes and create a new container for the deployment with all new resources and remove the existing containers.

Automatic bin packing

To run the containerized task, you can set up Kubernetes with a cluster of nodes and assign resources such as CPU and memory (RAM) to each container that best fits your nodes.

Self-healing

Self-healing is a feature Kubernetes provides by default; when a containerized application fails or goes down, Kubernetes can re-deploy the container and maintain the desired state of the application.

Secret and configuration management

Kubernetes allows users to store and manage sensitive information in Kubernetes Secrets, such as passwords, SSH Keys, credentials, etc. And also, you can manage these secrets and application configurations runtime, which means you don’t have to rebuild the container image or expose these secrets in the application configurations.

What is Kubernetes Container orchestration?

Kubernetes has become the industry standard for container orchestration, allowing developers to build and deploy containerization applications and manage them using the Kubernetes system. Many other container orchestration platforms, such as Docker swarm and Apache Mesos, are available in the industry. However, Kubernetes has become everyone’s favourite because of its features and functionality, providing an
environment for developers to build and deploy a highly scalable cloud-native software application. Kubernetes container orchestration platform is compelling and provides an extensive container capability with configurable features like auto-scaling, auto-healing, auto-replication and more. Kubernetes’ system is very portable in most cloud providers by addressing all the technical challenges to run the application in a wide range of environments.

What is the role of Docker in the Kubernetes System?

Docker is a software platform, and its primary job is to create containerization applications, and Kubernetes uses Docker as container runtime to orchestrate the running containers. And when Kubernetes schedules a pod to a node, the kubelet agent on that node communicates with the container runtime over Unix sockets using gRPC and provides instructions to launch a container. Then the kubelet monitors the status of the running container and collects information from Docker, and
processes all information in the control plane. So, in conclusion, the primary role of Docker in the Kubernetes system is that it receives instruction from an automated system to continue operating automatically with fault tolerance and without bothering an administrator to do things manually for all containers on all nodes.

Conclusions

Kubernetes has become the industry standard container orchestration platform. According to the CNCF survey, the number of Kubernetes developers is over 3.9 million worldwide, and 31% of backend developers use Kubernetes. The popularity of the Kubernetes system is enormous. It has become the leading container-orchestration system in the industry, with many Fortune 500 companies building and deploying their application to this popular open-source technology platform. And you should start using this platform as a backend infrastructure and get familiar with the various components of Kubernetes, so it will help you host and manage your application.

I hope you enjoyed reading this article, which gave you an insight into Kubernetes container-orchestration system. For more information on Kubernetes, you can also follow the official documentation.

--

--

Python | Application Security | Web Security | Cybersecurity | Software Development