Features of Kubernetes
Updated: Oct 12, 2021
If you haven't already understood the core concept of what a Docker container is, check out our previous blog on the basics of Docker containers and how they compare to Virtual machines.
Features of Kubernetes
Use Case 1: Rolling Back Changes
Lets say you deployed your application in a Docker container to your production environment. However you quickly realized there is a bug in your application and need to rollback the change. This would require you to go onto your production machine, spin up a new docker container with an older version that doesnt contain this bug. Once your application is stable you could then remove the container with the bug.
However, this is very cumbersome process and is open to you introducing new bugs into your system. Rather than doing this yourself, you should have a container orchestration tool like Kubernetes rollback the change for you.
Use Case 2: Rolling Updates
Understandably as you rollout the new version of your Docker Container, you would like to test to make sure the application is working as expected. Once this is verified you would slowly rollout the new version of your containers and replace the older version of your application. This is known as a rolling update.
A lot of organizations have created custom solutions to handle rolling updates, which involve deploying your application, running unit / integration / system tests, and then increasing the number of instances of your application.
However this is also a very cumbersome process and writing custom solutions are prone to errors.
Vanilla Kubernetes solve this out of the box, as one of its main features is the ability to perform rolling updates of your application-
Use Case 3: Horizontal Scaling
Lets say you deploy a docker container that runs a web application in your production environment. However you quickly notice that during peak hours your container cant withstand the traffic that is being sent its way. In the day's of bare metals, you would have to deploy a new instance of your application and have your load balancer send requests to both instances of your application.
This requires a lot of manual intervention and custom code that needs to be written. Kubernetes will handle this layer of orchestration for you out of the box. When Kubernetes recognizes there is an increase in traffic, it will automatically horizontally scale up the number of containers your application has
Lets assume that you have 5 Kubernetes Pods that are running your application and one of the pods goes down. Kubernetes will automatically self heal your application and start up a new pod. In order to detect when a container should be restarted or when a container is ready to accept traffic Kubernetes uses a features known as probes.
For example, Kubernetes uses a liveness probe to know when to restart a container. A liveness probe could send a GET request to one of your REST endpoints in your web application, if the request is unsuccessful Kubernetes will know to restart your container.
Interested in learning more about Kubernetes? Check out our Training Services specializing in Kubernetes, and Kubernetes Security.