Kubernetes Cost Allocation in a Nutshell

Chriso Klepke
Replex
Published in
4 min readSep 10, 2018

In the last couple of years, Kubernetes has emerged as the go-to container orchestration tool for developers. Despite having a steep learning curve, companies are jumping on the Kubernetes bandwagon, making it one of the fastest growing open source projects of all time.

As companies transition to production environments on Kubernetes, leveraging several cloud providers and on-premise infrastructures, one of the first challenges they encounter is how to accurately allocate the increased costs to different teams, services, applications and departments.

Why do I need to worry about allocating Kubernetes costs?

If you have a production grade Kubernetes environment up and running, and haven’t heard from finance yet, trust me you will.

As you scale your kubernetes environment and your deployments grow larger, costs are bound to increase. Additionally, companies are spending much more on adopting container technologies, which feeds into the overall IT spend. Case in point; The number of companies spending $ 500,000 annually on their container environments saw an increase of 27% as compared to last year.

Management wants transparency into these costs and their respective allocation to different services, teams, applications and departments. Being able to map these costs and identify them as driving agility and efficiency in individual teams or services, is also an important aspect of cost allocation.

Accurately allocating these costs to different services and teams, while being a major requirement in itself, is also a first step towards ensuring that the underlying infrastructure is being efficiently utilized.

Why Kubernetes cost allocation is not easy?

The core problem with Kubernetes cost allocation efforts is the lack of visibility into how kubernetes cluster resource usage is related to the cost of the underlying cloud or on-premise infrastructure.

Kubernetes’ shared resources model pools the entire underlying compute infrastructure into an overarching entity called clusters. Clusters in turn are made up of individual units of memory and CPU (compute) called nodes. Nodes can be anything from a virtual machine running on a public cloud provider to a physical one running in your data centers. By abstracting away this complexity and also adding another layer of OS abstraction on top, Kubernetes drives efficiency and agility for development and operations teams.

However, this shared resources model also means that multiple teams and services utilize resources from the same underlying infrastructure. This makes it difficult for IT managers and finance departments to accurately allocate Kubernetes costs to different services, teams, departments and applications.

The fact that kubernetes is agnostic to the underlying infrastructure and can run across any number of cloud providers and/or physical infrastructure also means that your containers can pop up anywhere across nodes in your cluster. Keeping track of where nodes and clusters are actually running is essential to cost allocation efforts.

Questions about the overall cost footprint of Kubernetes clusters can have easy answers. Overall Kubernetes costs can be easily co-related to public cloud provider bills (doing this for on-premises infrastructure is not so straightforward). However, a quick look under the hood reveals that visibility into cost drivers and being able to allocate cluster costs to specific teams, applications, services or departments is not all that easy.

Can I use Kubernetes Namespaces to allocate costs?

Kubernetes namespaces are a way of dividing a Kubernetes cluster into several virtual clusters. These virtual clusters can then be allocated to specific teams, services or applications. Cluster resources can also be allocated to namespaces using resource quotas.

The most common use-cases that namespaces cover are related to authorization including access management for different roles and defining different development environments like dev and production.

Kubernetes namespaces are a good starting point for cost allocation. However, it is important to note that namespaces only provide a way for virtual partitioning of your resources. To get fine grained visibility into the cluster resource usage of different namespaces and how they translate into underlying infrastructure costs requires the use of dedicated tools.

About Replex

The last couple of years has seen a mass migration of enterprises to microservices architecture and container technologies. Current container monitoring and optimization solutions leave a lot to be desired. At Replex, we are dedicated to putting you back in charge. Replex gives you detailed insights and granular control over your container infrastructure cost, governance and optimization. We also have a dedicated kubernetes section which helps you allocate costs as well as optimize kubernetes resource usage.

Want to dig deeper and understand how different teams or applications are driving your costs? Request a quick 20 minute demo to see how you can seamlessly allocate Kubernetes costs while saving up to 30% on infrastructure costs using Replex.io.

Originally published at www.replex.io.

--

--

Chriso Klepke
Replex
Editor for

No Fuzz Marketer | Fancies great Web/UX Design | Sneezes so loud others get startled