Introduction to Kubernetes

Soham Mehta
3 min readDec 24, 2023

--

Why we need Kubernetes as we have Docker?

  • Docker is primarily a containerisation platform. It enables developers to package applications and their dependencies into a single unit called a container. Containers are lightweight and portable, ensuring that an application runs consistently across different environments.
  • Kubernetes, on the other hand, is a container orchestration platform. It helps in automating the deployment, scaling, and management of containerized applications. It handles the deployment and scaling of application containers across clusters of machines.

What are the problems with Docker?

  • Single Host Only:

Consider a scenario where hundreds of containers have been created. Let’s assume that Container 1 is consuming a significant amount of memory. Due to this memory consumption, the image of Container 100 is unable to be pulled, resulting in its failure to start or causing it to terminate. There is no direct relationship between Container 1 and Container 100, yet the issues with Container 1 are impacting Container 100. Essentially, on a single host with Docker installed, one container is failing, and as a consequence, another container is also experiencing issues.

  • Lack of Auto Healing:

Suppose someone terminates a container; as a result, the application running within that container becomes inaccessible. To resume using the application, someone must restart the container. This process is known as ‘Auto Healing.’ Numerous factors can cause a container to go down without manual intervention from the user. Continuous monitoring and automatic creation of a new container become crucial since it is impractical for someone to observe and initiate container replacements all the time.

  • Lack of Auto Scaling:

Imagine you have a container with a maximum capacity of 4 GB RAM and 4 CPU cores. As the number of users increases, there is a need to automatically balance the load, a process known as ‘Auto-Scaling.’ However, Docker, by default, lacks built-in auto-scaling features, meaning that manual intervention or third-party tools are required to address this limitation.

  • Docker Limitations in Enterprise-level Features

Docker lacks certain enterprise-level standards, as it doesn’t inherently provide features like a built-in load balancer, API gateway, firewall, blacklisting, whitelisting, and other advanced functionalities. To achieve these capabilities, users often need to integrate Docker with external tools or employ a comprehensive container orchestration system.

How Kubernetes solves this problem?

  • Kubernetes is a cluster of groups of nodes in a master-slave architecture. As it has many nodes, if Kubernetes detects a faulty node, it relocates the pod (For the sake of simplicity, consider a pod as an application) to a different node. This addresses the first problem — Single Host Failure.
  • Kubernetes has its own API server. Whenever any container goes down, it receives a signal that the server is experiencing an issue. Even before the container goes down, Kubernetes immediately creates a new container, resolving the second problem — Auto Healing issue.
  • Kubernetes incorporates a replica set that allows both manual scaling and Horizontal Pod Autoscaling, resolving the third problem — Auto Scaling Issue.
  • To run your application in production, you need a load balancer, firewall, and all other enterprise-level features that Docker doesn’t provide, whereas Kubernetes encompasses all these features.

We will see the Kubernetes architecture in next article. Thanks for reading!

--

--

Soham Mehta

Expressing a strong interest in modern frontend tech, particularly JavaScript, and a deep passion for working with React and React Native.