matharoo

Categories

  • devops

Tags

  • devops
  • kubernetes

why-k8s

It has always been a trend in software industry to jump on newer technologies or start putting in lots of resources into implementing newer tech stacks just because of the buzz around the word and usually the fear of missing out. Often the lack of proper research into the technology leads into wastage of financial resources and most importantly time. Last month in September of 2020 Kubernetes turned 5 which is not a very long time still that its been around but the traction that the project gathered over the last few years has been amazing. Lots of newer tools like helm quickly became popular and almost became a defacto standard for making things even simpler for people who are new to K8s.

I feel like understanding the Why behind using the kubernetes and if its right tool for your applications is very important, so I have made a small list over the time to actually help you see if its the right fit. Lets go:

Why to use it:

  • Containerization: If you are already shipping your application within containers or are currently exploring the way to deploy your microservices based application into separate containers then you will be amazed how easy K8s will make your life. The kubernets in general is container orchestration software that allows for easy managemnt and deployment of such applications giving you the in depth ability to control the resources, scale and keep your applications up all the time.
  • Independance from sticking to one cloud provider: In the kuberenets all the infrastructure is yaml manifests based which is compatible with all the major cloud platforms like AWS, Google Cloud, and Azure, pretty sure more are coming as the eco system is expanding rapidly. The great thing if tomorrow one cloud platform decides to raise their prices or decides to end one of their services then its very easy to switch the cloud platforms as the same K8s manifests can work easily with other cloud platforms with very minimum to zero changes needed. This can also be seen from another perspective as if a company doesnt want to rely on one cloud platform and having your application easily be working on multiple clouds can provide the peace of mind.
  • Easy Scalability: Kubernetes was built keeping in mind the scalability needs around any applications. Kuberentes have replication controllers, schedulers, load balancing techniques(spreading traffic evenly to pods in on all nodes), networking that allows multiple spawning of new pods and nodes in the cluster to allow the application to handle spikes in usage of our applications. When the load is low the intelligent K8s will then automatically scale down the pods and nodes.
  • Self healing: K8s comes with health checks for your applications like health probes, startup probes that helps to know if the pod running your application is stuck and not working properly, so when the health checks start to fail K8s automatically replaces the faulty pods with newer pods.
  • No downtime: As K8s is pretty much self-healing system, it allows us to set the minimum number of replicas of our application to always run when deploying newer versions of our app or in case app pod fails which then gets replaced automatically there by giving us upto 99.99% uptime. Also it comes with Auto Scaling feature to allow a minimum number of worker nodes to be available for the application to prevent any downtime. Even when there is any update happening to K8s itself its done in a way that the worker nodes are usually replaced in a fashion that our application stays up.
  • Faster deployments: Kubernetes allows easy rollout for the newer version of our applications with rolling update strategy in which there is always a minimnum number of pods set in our deployment yaml available and then phase out the old pods one by one with newer version of the application. Its also important to note that it will only start sending traffic to the new pods only when the desired number of those pods is available while its phasing out the older ones. In case the newer deployment has problem then the older pods are always still there and not phased because the health checks start to fail.
  • Lower costs: This last piece of why to use K8s can be tricky. Traditionally we just end up spinning the specific types of instances for our applications like EC2s in case of AWS as the load grows but we are never too sure about if the newer instances we launch are even being used efficiently enough. So when you start to implement K8s for your application it might seem a little bit of an overkill due to many components and the amount of complexity around them. But when things start to clear up and the K8s is implemented in a right way, it can help you lower the costs of running your applications. The main reason being its ability to allow us to manage the amount of resources our application is using i.e. the CPU and memory. Once we are in full control of it then over time we can control it at optimal levels and lower the operating costs of our app based on the amount of load it gets.

Why not to use it:

  • Simple applications: If your application is tightly packed simple monolithic architecure and you dont have to bother much about the amount of traffic load they recieve then K8s is not the right choice for you as it will only end up increasing the complexity of running such an application. But even if your monolithic application is growing up in user base and needs to be more efficient in handling the loads then there is a chance that K8s can come to the rescue for sure.
  • Steep learning curve: As mentioned at the start of this post that there needs to be a good amount of research that needs to be conducted before jumping the gun as the implementation of kuberenetes at least in my experience needs testing to make sure it can be a right fit for the business. Thanks to the devops community for picking up this techinology and there are lots of new tools like helm, helmfile,etc and growing documentation around K8s is helping devs try their hands on K8s in easier way. If not properly tested for the use case you are trying to fit the K8s for then it can also result in higher implementation costs which includes training and then higher compute resources costs( will cover soon how to decide what instances to use for K8s system).

So overall I feel K8s is a great tool that can help scale you appliction to meet the needs as it grows but always take new tech with a grain of salt and there needs to be proper analysis done before we get to implementation stage.

Thanks for reading!