Resources

Is Kubecost Worth It?

October 11, 2021

This article explains how Kubecost records event data and logs to analyze a company’s costs and allocation of resources, making it a useful tool for companies looking to optimize their use o

Boemo Mmopelwa
Software Engineer

As the use of containerized applications keeps growing, so does the need to control costs. The last thing you want is a $120,000 Kubernetes bill. The challenge is to monitor your expenses in Kubernetes as your cloud infrastructure expands.

One solution is to install an automated cost management system to cut down on the time and effort of manual per-container calculations, as well as to reduce the chance of errors.

In this article, we will take a closer look at Kubecost, a Kubernetes cost optimization tool.

Cost Monitoring in Kubernetes

The Kubernetes cost monitoring process involves capturing and recording event data and logs from Kubernetes clusters, pods, applications, and containers.

The table below defines the components that are involved in the monitoring process:

Component Purpose
Kubernetes Cluster A set of nodes running containerized applications.
Kubernetes Pods A small deployable object that represents a single instance running in your cluster.
Containers An executable software package that contains all the requirements needed to run an application.
Containerized Application An executable software program that is packaged in containers with their required dependencies.

You can use two metrics to capture data from Kubernetes. The first is the resource metric, which requires that you have installed the Metrics server. This metric contains data on:

  • CPU
  • memory usage
  • filesystem space

The second is the service metric, which contains information produced by Kubernetes infrastructure components.

Calculating Costs Manually

“By 2022, over 90% of enterprises worldwide will be relying on a mix of on-premises/dedicated private clouds, multiple public clouds, and legacy platforms to meet their infrastructure needs.”–IDC

It is possible to monitor costs by calculating the cost of each container. However, this becomes more difficult when your containers and applications are scattered among cloud platforms using different nodes, as the quotation above highlights is often the case. In addition, calculating the cost per container is time-consuming and requires infrastructure. As projects use different containers and clouds, you can’t track all the resources a container is using from a server, which reduces cost transparency.

How Kubecost Works

An overview of the Kubecost dashboard. Photo credit: Kubecost
An overview of the Kubecost dashboard. Photo credit: Kubecost

Kubecost collects real-time data from Kubernetes and analyzes it, giving you a detailed cost breakdown. Kubecost, which is specifically designed to work with Kubernetes, uses these metrics and cost categories:

Metrics Used Cost Categories
Time in running state Monthly cluster cost
Consumed and reserved resources Deployment resource cost
Price of resources consumed or reserved Cost efficiency

Kubecost offers a paid and a freemium version. The freemium version limits data storage up to fifteen days. When installed, Kubecost comes with a 32 GB persistent volume, which is enough to retain 300 pods. You can integrate Kubecost with these cloud infrastructures:

How Kubecost Helps Control Costs

Kubecost provides cost reduction recommendations. Photo credit: Kubecost
Kubecost provides cost reduction recommendations

The Kubecost cost allocation model can analyze costs on any Kubernetes level, supporting native Kubernetes concepts including clusters, namespace, controller, deployment, service, label, pod, and container.

Kubecost uses the data to tell you how to optimally tune nodes and pods. It finds underutilized nodes and storage, so that you can more effectively use or eliminate them.

A recently launched feature helps you find an optimal set of nodes for a Kubernetes cluster, giving you recommendations on cluster configurations. This can help users achieve savings of twenty-five to sixty percent.

Kubecost measures idle memory as a percentage of your overall cluster spend. You can use that data to determine where to more efficiently use resources.

Its notification feature will alert you when your cost threshold has been met, so that you can take action to stop further costs. Kubecost also allows you to set recurring updates on scheduled cost reports allocated by namespace and set thresholds based on your financial goals.

With the premium version, you can allocate costs to apps and teams by adding role access to the cloud provider billing data. That transparency helps you avoid resource bottlenecks.

Benefits of Kubecost

Adding Kubecost to your Kubernetes tools can help you keep your costs down and improve your company’s productivity. In addition to the above features, here are some of the benefits it offers:

  1. Real-time cost allocation and cost allocation configurable by labels, so that you can measure the cost of every product and team
  2. Dynamic asset pricing when you integrate Kubecost with AWS and Google Cloud Platform
  3. Cost allocation metrics for CPU, GPU, memory, and storage
  4. Enterprise support and a lengthy metric retention period

Finally, its detailed cost analyses help you adjust your operations to ensure you’re not wasting money or resources.

Kubecost vs. Alternatives

There are other tools that offer similar services, such as CAST AI. In addition, Kubecost lacks the auto scaling mechanisms that competitors offer, such as for horizontal pods or nodes. Kubecost’s focus is on cost optimization tools.

However, it offers features that other tools don’t, such as:

  • connecting in-cluster with out-of-cluster costs
  • connecting dedicated cloud provider services with components
  • providing distribution of shared in-cluster and out-of-cluster costs across the organization

Kubecost also offers a good level of security, as it defaults to read-only Kubernetes privileges and doesn’t ship any data out of your cloud infrastructure.

Conclusion

As your cloud infrastructure grows and your Kubernetes expenses escalate, you need to find effective ways of managing costs as well as workflow. Kubecost can help you achieve these goals.

An additional tool for monitoring Kubernetes metrics and events is ContainIQ. This platform offers pre-configured dashboards for companies to measure performance. By helping you diagnose and solve problems more quickly, ContainIQ offers another way to save costs and improve your product.

Article by

Boemo Mmopelwa

Software Engineer

Boemo is a software developer who embraces innovative approaches and likes diving deep into complex methodologies in order to learn and write articles that can help the reader understand complex methodologies in a simple and fun way.

Read More