What Drives the Cost of Kubernetes?: Part 1 of 2

Kubernetes has emerged as a leading cloud technology for deploying applications. This powerful platform’s APIs enable you to dynamically provision compute and infrastructure resources, making deployed applications scalable, modular, and fault tolerant. Of course, this computing power comes at a price, and creating the most optimal provisioning declarations is not always easy.

Despite the above-mentioned Kubernetes benefits, there are challenges planning and tracking costs associated with running those applications — or to be more precise, the provisioned infrastructure necessary for running them. When more teams in your organization develop and deliver their applications with Kubernetes containers, the landscape quickly becomes crowded and fragmented, resulting in a big bill in your inbox. To keep that bill in check, organizations need some solution for making visibility and cost control easier.

Let’s back up for a moment and see where we start to get in trouble.

Infrastructure as Code

Surely, Infrastructure as Code (IaC) was not invented by Kubernetes. However, this method of creating reusable provisioning plans plays well with the Kubernetes concept. Now, dedicated infrastructure engineers can create, maintain, and verify infrastructure demands in version-controlled documents that are reliably used by a provisioning service. Placing such manifests in an application development process gave rise to the DevOps paradigm, where infrastructure engineers are no longer fully dedicated, but rather software engineers, too.

With the rise of the DevOps paradigm and the container-orchestration technology Kubernetes, more and more developers are adopting Kubernetes for development as well as deployment. It takes care of a lot of low-level infrastructure and makes it easier to deploy, manage, and scale applications. Here, Kubernetes acts as a provisioning service that can freely create and destroy resources as needed.

The need is actually defined by the developer. The developer can just declare the state environment that an application needs to be in and Kubernetes constantly works to maintain that state, freeing developers from manual infrastructure management tasks.

Quite often, however, this state is not ideal. Developers tend to overestimate the required resources (number of instances, memory amount, or CPU power) to avoid not having enough resources during runtime. This eventually leads to paying too much for resources that aren’t being used.

However, even if we use all available technical means to perfectly balance our state with the actual need, we can still pay too much. Sometimes a certain service is responsible for most of the cost, and there are tools available that can identify where we could save money by right sizing our reservations.

In any case, in the end, we’ve probably put a lot of effort into understanding Kubernetes and aligning our application architecture, development processes, and continuous integration/continuous development (CI/CD) pipelines to take advantage of Kubernetes. So, now the million dollar question is: How much will a particular cluster cost?

Keeping Track of Costs

Anticipating what it’s going to cost to run those clusters is crucial. If we can align those costs with projects and teams, then we can easily optimize the paths that will bring the most value. Since Kubernetes is mostly used in a dynamic, multi-tenant environment, it’s difficult to see what is driving cloud costs. There are multiple problems teams can run into.

One problem is certainly that spikes in usage increase cost quickly. Although handling such spikes is one of Kubernetes’ strengths, the short timespan and potential invisibility makes it hard to know why costs skyrocket.

We already mentioned the other problem: teams tend to overprovision to avoid potential resource shortage. If everyone does that, costs add up until it’s just too much. While development scales really well with Kubernetes, costs do not scale so well – at least in the sense of affordability.

Technically, if multiple teams with multiple applications share a single Kubernetes cluster, we will have a hard time understanding who is using what, and who is actually responsible for which portion of the overall costs. Overall, this just means that we need a good strategy to trace costs back to apps, teams, or business units when we’re running services in a Kubernetes cluster.

Strategies for Understanding Kubernetes Costs

In part 2 of this series, we’ll explore Kubernetes cost allocation, cost monitoring and what Yotascale can do for you to manage your Kubernetes costs. To get started now with optimizing your Kubernetes infrastructure budget, and learning more about Yotascale, start by requesting your Yotascale demo today.