
Kubernetes – A Container Orchestration Tool
Introduction
Containers have become the definitive way to develop applications because they provide packages containing everything you need to run them. Kubernetes is an open-source Container Management tool that automates container deployment, container (de)scaling & container load balancing. In simple terms, Kubernetes is used to run multiple Docker containers across nodes (multiple cloud servers).
· Written on Golang, it has a huge community because it was first developed by Google and later donated to CNCF [Cloud Native Computing Foundation].
· We can group ’n’ no of containers into one logical unit for easy management and deployment.
The name was created by taking the first eight letters of "ubernete" and replacing it with the number eight which gives us the abbreviation K8s. The Greek word "Kubernetes" means "helmsman" or "pilot."
The Kubernetes project began in 2014, after Google's internal container cluster managers Borg and Omega had more than a decade of experience running production workloads. It facilitated the adoption of emerging software architectural patterns like microservices, serverless functions, service mesh, and event-driven applications, and paved the way for the entire cloud native ecosystem.
Most importantly, because of its cloud-agnostic design, containerized applications can run on any platform without requiring any changes to the application code. Today, not only large enterprise deployments can benefit from the Kubernetes ecosystem, but small to medium-sized businesses can also save a significant amount of infrastructure and maintenance costs by utilizing it in the long run.
Going back in time
Traditional Deployment Era
When multiple applications run on a physical server, there were instances where one application occupied most of the resources, causing the other applications to underperform. This was resolved by running each application on a separate server. Due to underutilization of resources, organizations had to maintain many physical servers, which was expensive.
Virtualized Deployment Era
As a solution, virtualization was introduced. It allowed you to run multiple Virtual Machines (VMs) on a single physical server's CPU. Virtualization allowed applications to be isolated between VMs and provided a level of security as one application’s information cannot be freely accessed by another application.
Container Deployment Era
Containers are like VMs, but they have relaxed isolation properties to share the Operating System (OS) among the applications. Therefore, containers are considered lightweight. Like a VM, a container has its own filesystem, share of CPU, memory, process space, and more. As they are decoupled from the underlying infrastructure, they are portable across clouds and OS distributions.
So Why Kubernetes?
Key Features
· Kubernetes automatically packages and schedules containers based on requirements and available resources without compromising availability.
· A Kubernetes cluster is automatically configured with IP addresses and a single DNS name, so no need to worry about networking and communication.
· Kubernetes lets you mount any storage system. It is possible to use local storage, a public cloud provider, such as GCP or AWS, or a shared network storage system like NFS or iSCSI.
· Containers that fail during execution can be restarted automatically, and containers that fail to respond to user-defined health checks can be killed by Kubernetes. If a node dies, it replaces and reschedules the failed containers.
· Kubernetes also manages batch and CI workloads, replacing failed containers, if needed.
· With Kubernetes, you can deploy and update secrets without rebuilding your image and without exposing secrets in your stack.
· When using the CLI, Kubernetes requires only one command to scale up or down containers. A dashboard (Kubernetes UI) can also be used to scale.
It helps us run the container using the docker run command or docker-compose command. But the problem with Docker is that it is limited to one computer. Yes, we cannot run multiple instances of the application across the cluster (multiple computers or nodes). It means, we must log in to each computer to execute the docker commands. We cannot do it from one computer.
A scenario
Assume you created an online shopping application. And you intended to deploy this application as a Docker container. You also created a Docker image for the application and deployed it as a Docker container. Because of the app's popularity, your customer base has grown. Because of high traffic to the application, your server crashes. You now intend to set up a cluster. So, you used Docker to run five instances of the application on one computer. The load is now distributed, and the server can easily manage the traffic.
Once again, the traffic to your application is increasing. One computer cannot manage five instances. Hence, you planned to add more computers to your Docker container cluster. This is where the real problem lies.
1. It is easy for Docker containers to communicate on one computer. However, it cannot be used across different computers.
2. It is a bit tedious to replicate data. We must work to create an N instance.
3. Docker cannot detect if the running container has crashed.
4. If one container crashes, we must manually up [run] the container. It does not have the self-healing capacity.
To address the above-mentioned problems, we need a container orchestration tool. That is Kubernetes.
Kubernetes Provider
Kubernetes is now the de facto standard for deploying containerized applications at large scale. AWS, Google Cloud, Azure, IBM Cloud, and Oracle Cloud now offer managed Kubernetes services. Popular providers are listed below.
1. AWS — KOPS, EKS, Fargate. EKS (Elastic Kubernetes Service) is popular.
2. GCP — GKE (Google Kubernetes Engine).
3. Azure — AKS (Azure Kubernetes Service).
4. DO — DOKS(DigitalOcean Kubernetes).
5. Linode — LKE(Linode Kubernetes Engine).
Kubernetes simplifies the work of the application deployment team by managing multiple Docker containers across the cluster. If you are running multiple Docker containers, you will undoubtedly require Kubernetes to manage them. Many popular cloud providers provide managed Kubernetes services. This simplifies the configuration of the Kubernetes Master and Worker nodes.
I hope this article clarified the different challenges faced while using Docker and the role of Kubernetes, the container orchestration tool, in simplifying work processes.
References:
From https://medium.com/codex/why-you-need-kubernetes-511eb4948bf2
From https://medium.com/containermind/a-beginners-guide-to-kubernetes-7e8ca56420b6 From https://medium.com/codex/why-you-need-kubernetes-511eb4948bf2
From https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/#going-back-in-time
From https://medium.com/edureka/kubernetes-architecture-c43531593ca5
From https://medium.com/edureka/what-is-kubernetes-container-orchestration-tool-d972741550f6
