Kubecost case study

3 min read

Cover Image for Kubecost case study

A lot of applications and organizations run their applications on Kubernetes. This has certain advantages such as auto-scaling, multi-cloud capabilities, a ton of open source tools around it, and much more. However, it does come with some disadvantages as well. In this article, we will be focusing mainly on the cost aspect.

How Applications Run on Kubernetes

Before we go looking into the problem, let's see how applications run on Kubernetes. As you know, Kubernetes runs containers and connects hundreds or thousands of containers, services, persistent volumes, etc. This is the most basic way in which you can use Kubernetes. To increase what Kubernetes can do, we also use lots of third-party services to implement features such as logging, monitoring, tracing, etc. While these services are not essential to running your application, they provide some good features which can help troubleshoot Kubernetes in case of any errors.

This is a very basic explanation of how applications run on Kubernetes. If you want a more in-depth explanation, you can refer to this article.

The Problem With Managing Kubernetes Costs

When you deploy your application to a Kubernetes cluster, you would usually use a cloud provider such as Civo. Generally, you might be overprovisioning resources for running your Kubernetes clusters. What this means is that you have provisioned 4 cores, and 8 GB of ram, but you are only using 2 cores, and 4 GB of ram.

The remaining resources are idle and are being wasted. You are still paying for those unused resources anyway.

Developers also tend to use Infrastructure as Code tools such as terraform to automatically provision resources in case of high demand. This also could lead to even more resources (and money) getting wasted.

What is Kubecost and How Can it Help?

Kubecost is an open-source Kubernetes cost management system, which helps you better understand your cost requirements for Kubernetes and reduce how much you spend. This is done in real time and is completely automated, meaning teams can focus on creating rather than worrying about their costs.

Kubecost can be integrated with your cloud provider and can provide real-time data on how much you are spending, and optimize your costs. Kubecost automatically generates insights you can use to save 30-50% or more on your infrastructure spend, without exposing your private information. It can also be used to view and optimize costs across multiple cloud providers.

Kubecost comes with a web UI that can be used to monitor, identify, and optimize how much you are spending on Kubernetes. Kubecost can optimize your Kubernetes spend without compromising on performance.

You can also use Kubecost to set a limit on how much your cloud is spending. Once you reach the threshold, Kubecost can send you a notification via slack or email. This empowers teams to take control of their Kubernetes-enabled infrastructure, stay within budgeted limits, and address monitoring interruptions immediately.

How Does it Work?

The core architecture of Kubecost is very simple. Kubecost works alongside Thanos to monitor your cluster's resource utilization.

The Kubecost pod will take the metrics from Kubernetes API and use the billing data from the configuration provided by the user or taken automatically from the public clouds. With this information, the pod generates a set of metrics that Prometheus can scrape for use.

This information is then used to detect any overspending and optimize it.

Conclusion

Kubecost is a very useful tool when it comes to saving costs. It can determine if your provisioned resources are under-used which in turn can help save money. This is especially useful when you are running hundreds of nodes on your clusters and can save thousands of dollars.

Get Involved