Kubernetes - Basic Understanding for Beginners

Introduction

In our previous article, we explained what containers are and why they are important when deploying an application to the production environment. We also explained docker and why it is important. You can read more on that with the following link. Kubernetes is very important when trying to run various containers as a group and this is very important in solving the problem of scaling very powerful applications.

Container Scaling

While you could run individual containers by themselves, the real power comes when they can be managed as a group. This is very useful when solving the problem of scaling and application scaling to meet demand. They are two approaches to scaling that I will explain below.

  1. Vertical scaling Increasing the host machine's hardware resources on which the container is running is called vertical scaling. Earlier, we learned that a container has no resource constraints and can use as much of a given resource as the host's kernel scheduler allows. This approach's downside is that:
  • It is challenging to scale up or down as the demand changes automatically.
  • Larger host machines can be more expensive than smaller machines, so it is a loss if the machine is underutilized. Also, running an application in a single container alone doesn’t leverage the full power of containerization.
  1. Horizontal scaling Running multiple instances of the same application across multiple machines is called horizontal scaling. It is effortless to run multiple containers based on the same image.

image.png Credit: Webairy

Kubernetes

What is Kubernetes?

Kubernetes is one of the most popular open source container orchestration system for containers developed by Google and open sourced in 2014. It can automate many of the manual operations of deployment and scaling of a containerized application. A few of the benefits of using Kubernetes (k8s) are:

  • The ease of scaling the container instances up or down to meet varying demands(horizontal scaling).
  • It can help balance loads and perfom health checks
  • It can help set up inter-container communication (networking).

Kubernetes was born out of the lessons learned in the Scaling containerized apps at Google.

Benefits of using Kubernetes

A few more benefits of using Kubernetes are:

  • High availability architecture
  • Auto-scaling
  • Rich Ecosystem
  • Service discovery
  • Container health management
  • Secrets and configuration management The downside of these features is the high complexity and learning curve of Kubernetes.

Why is Kubernetes required?

  1. Scaling - You cannot automatically scale up-or-down the resources (number of containers) or application usage requirements based on the incoming traffic.
  2. Updates - Assume you have manually scaled up your containers horizontally on multiple hosts. Now, develop a patch/update in your application. It will be difficult for you to update the patch in each container manually.
  3. Elasticity - Your local computer/on-premise servers may not suffice the hardware requirements for running too many containers parallelly.