In this post, we will discuss a brief overview of how industries are using Kubernetes, need and it’s working.
Apart from this we will also concise the difference between what Kubernetes is and it’s not as there are myths and confusions around communities misconceived Kubernetes to be a containerization platform.
Well, it’s not so we will be discussing what it is? and what it’s not?
We will be discussing on a use case where how Kubernetes was used at Pokemon Go and how it helped Pokemon go will become one of the best games of the year 2017.
And finally, at the end of the blog, you will get a demonstration of how to do deployment with Kubernetes.
What you will learn:
Need Of Kubernetes
What exactly is it? & What it’s not?
How does Kubernetes work?
Use-case: Kubernetes At Pokemon Go
Before understanding Kubernetes we should know what a container is and its working.
Why do we need Kubernetes?
Firstly to understand why we need Kubernetes lets to understand what are the benefits and drawbacks of containers.
First of all, containers are amazingly good it could be a Linux container or a docker container or even rocket container, they all do one thing, they package your application and isolate the application from the host.
These properties make container fast, reliable efficient lightweight and scalable.
Now hold the thought yes containers are scalable but then there is a problem that comes with that and this is what is the resultant of they need for Kubernetes even though containers are scalable they are not easily scalable.
So let’s look at this way you have one container you might want to probably scale it up to two containers or three containers.
Well, it is possible it’s going to be a little bit of manual effort but you can scale it up.
Now considering with the real-world scenario where you might want to scale up to like 50 to 100 containers then in these cases what happens is that you have to manually set up, manage and customize reports for every action.
If each container is unable to communicate or share the status of the container to its server, then the reestablishing or recovering or scaling container will be complex with manual accounting.
Challenges while scaling up the containers manually:
Scaling up the containers is pretty easy but the problem is what happens after that.once you scale up the container you will have a lot of problems.
- Containers cannot share signals or reports manually. Thus, there will be a communication drop where the user has to manually manage reports for each container.
- Containers have to be deployed appropriately(Explain in detail).
- Containers have to be managed carefully.
- Autoscaling will be impossible.
- Distributing traffic will be challenging.
Why do we need autoscaling?
Let me explain with an example. Consider your own an e-commerce portal say amazon or Flipkart.
Consider you have a decent amount of traffic on your portal on weekdays but on weekends you have spiked in traffic probably 4x or 5x the usual traffic.
In this case, your servers may respond to the requests which are received on the weekdays because of less traffic.
But, on weekends due to increased traffic requests your server may take more time or may hover for some time due to unexpectedly high traffic.
If you want to avoid this problem, what do you do? You have to scale up and now would you ideally keep scaling up every weekend and scaling down after the weekend
Technically is it possible will you be buying your server and then setting it up and every Friday would you be again buying new servers setting up your infrastructure and then the moment
when your weekday’s start will you just destroy all your raw servers whatever you build.
How do you avoid this problem?
A general solution is to scale up the resources every weekend and scale down the resources after the weekend.
“This solution is not optimized or the best solution for the above scenario”.
In truth, “It will be difficult” to set up and manage the servers and other infrastructure resources whenever there is a requirement and scale back the resources when there is less or no requirement.
So, in this case, for auto-scaling, we can use Kubernetes. Kubernetes keeps track of your server traffic, container resource utilization, and when the traffic is high or reaches the threshold auto-scaling functionality will be activated accordingly.
Kubernetes autoscale the containers accordingly without any manual intervention. Thus this auto-scaling function attracting organizations to adopt Kubernetes.
So, What is Kubernetes?
Kubernetes is the container management tool that automates container deployment, container scaling, and container load balancing.
The benefit of Kubernetes is, it works brilliantly with all cloud vendors like Amazon web service, Google cloud platform.
Kubernetes a google designed product written in go language is an open-source project now maintained by CNCF – Cloud Native Computing Foundation which aims to build sustainable ecosystems and advanced communities to support the growth and health of the cloud-native open-source software.
Features of Kubernetes
Here are the key features and selling points of Kubernetes
● Automatic Bin packing
● Service Discovery & Load Balancing
● Storage Orchestration
● Self Healing
● Secret & Configuration Management
● Batch Execution
● Horizontal Scaling
● Automatic Roll Back & Rollouts.
1) Automatic BinPacking
Automatic bin packing is basically, Kubernetes packages your application and automatically places containers, based on their requirements and the availability of the resources.
2) Service Discovery And Load Balancing.
If you are using Kubernetes, then no need to worry about internal network address setup and management, thanks to Kubernetes will automatically assign containers on their own IP addresses and probably with a single DNS name for a set of containers which are performing a logical operation. Thus there will be a load balancing across them.
3) Storage Orchestration
With Kubernetes, you can automatically mount the storage system of your choice. You can choose either local storage or a public cloud such as GCP or AWS.
4) Self Healing
What self-healing is all about that whenever Kubernetes realize that one of your containers has failed then it will restart that container on its own and creates a new container in place of that container that is inoperative.
In case your node itself fails then what Kubernetes does is, the containers which are running in that failed node will be initiated and commenced on the other healthy nodes.
5) Batch Execution
So when we say batch execution its that along with services Kubernetes can also manage your batch and CI workloads which is more of DevOps role so as part of your CI workloads Kubernetes can replace your containers which fail and it can restart and restore its original state.
6) Secret & Configuration Management
This is another big feature of Kubernetes. This is the concept where you deploy and update your confidential or classified application or application configuration without rebuilding the entire image or exposing the classified application in your stack configuration.
7) Horizontal Scaling
You can scale your application up and down easily with a simple command. The simple command can be run on the CLI or you can easily do it on your GUI which is your Kubernetes dashboard.
8) Automatic Roll Backs and Roll Outs
Now what Kubernetes does is whenever there is an update to your application which you want to release, Kubernetes progressively rolls out these changes and updates to the application.
If the application is not compatible with the current version then Kubernetes will roll back to the previous versions.
Kubernetes “IS NOT”
The first thing is that Kubernetes should not be compared with docker because both have a different set of parameters that you may compare them against.
Docker is a containerization platform on the other hand Kubernetes is a container management tool.
It means that once you containerize your application with the help of docker containers or Linux containers and when you are looking forward to using the auto-scaling functionality, this where Kubernetes would come in.
Kubernetes “ACTUALLY IS”
Kubernetes is robust and reliable, Now when I say robust and reliable I am referring to the fact that the cluster that is created by the Kubernetes is very strong and it’s not going to be broken easily.
If your container gets failed Kubernetes will restart the container or start the new container in the same way if your node gets failed then the containers which are running in a particular container will start running on the different node.
Pokemon Go Using Kubernetes ( Use Case )
All of us very well known Pokemon go the very famous game and was actually declared as the best game of the year 2017. The main reason for that being the best is because of Kubernetes.
let me explain in detail?
Pokemon go is augmented reality game developed by Niantic for android and ios devices.
So let’s see the Backend architecture of Pokemon go.
We have a container that had two primary components one is your google big table which is your database where every data is stored and then you have your programs that are running on your java cloud. these two this running your game.
Mapreduce and cloud dataflow is used for scaling up. So it’s not just the container scaling up but its with respect to the application how the program would react when there is an increased number of users and how to handle an increased number of requests.
The Pokemon go have the capacity where they can go up till 5 times so technically they only serve 5x number of requests but in case of failure conditions or heavy traffic load they could not go beyond 5 times because then the server will start crashing.
What happened at Pokemon go on releasing in just those three different geographies is that the movement they deployed in the usage became so much that it was nit x number of times which is technically there a failure limit.
And even its not 5x which is the server capability but the traffic that they got was up 50 times which is more than what they expected.
So you know that if your traffic is so much then you are gonna be brought down to your knees and your application is gone for a toss.
So in this scenario where Kubernetes comes into the picture and they overcome all the challenges.
Because Kubernetes can perform vertical scaling and horizontal scaling at ease.
Scaling of servers containers is the biggest problem because any application or any other company can easily do horizontal scaling where you can just spin up a container and you set up the environment.
But vertical scaling is something which is very specific and this is even more challenging
Now it’s more particular with this game the virtual reality would keep changing. Whenever a person moves around or walks around somewhere in his apartment or somewhere on the road then the RAM that would have to increase.
The in-memory and storage memory all this would increase so in real-time your server capacity also has to increase vertically so once they deployed it’s not just horizontal scalability anymore.
Kubernetes solves all these problems effortlessly and Niantic also surprised that Kubernetes could do it.
Thanks to Kubernetes, Niantic was able to handle x50 times traffic.
Hope the above information given in this blog will help you to understand what is Kubernetes
In the next blog, we will see the Architecture, Installation, and Hands-on on Kubernetes.