,

How does a basic web application work? Why do we need Kubernetes?


Based on the Kubernetes document “Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation”. This is for beginners to understand how Kubernetes works so I am trying to focus on the “managing containerized workloads” part.

Before we understand how Kubernetes work, we must understand how a basic web application work. For a simple web application, the application itself must be running on a web server and to store the data, it must be connecting to a database server. When an end user browse an URL(e.g. , https://techlearners.blog), the request goes to web server. Web server looks for the corresponding resource and asks database to return the data. Then, web server prepares the response and send it to the browser.

For illustration, imagine our web application has good amount of traffic now. We have containerized the application using Docker. To make sure the availability of the application, we need to have 4 instances of the web application running and traffics routed via load balancer. The application is also connected to a backend database to get information.

Now we need monitoring in place to make sure all the servers or VM are up and running. What if we have a tool that can monitor server /application health, and start/restart the application in case of any issues.

This is what exactly Kubernetes does. It wraps docker containers inside Pods and run multiple instances of application. Performs load balancing, monitoring and self healing in case of any issue.

Kubernetes can do a lot more but these are the basic Kubernetes features to start with. We will learn more on this.