Guest post originally published on Fairwinds’s blog by Liz Coolman

Organizations have moved increasingly to the cloud, adopting containers and Kubernetes to change their infrastructure and take advantage of these cloud native technologies. Kubernetes itself is complex, requiring new skills and increasing levels of maturity as you move from pre-production implementation to improving operations and optimizing environments. Further complicating the Kubernetes adoption process is the challenge of putting Kubernetes cost control strategies in place.

Kubernetes and total cloud cost

Calculating the total cost of ownership for running applications and services in the cloud is more challenging than simply buying a set amount of compute and storage and assigning that to a team. Cloud computing has given organizations on-demand access to compute resources, making cost a much more dynamic problem to forecast and control.

There are a variety of costs involved in hosting, integrating, running, managing, and securing cloud workloads over time. Some charges relate directly to compute consumption, data transfer, and storage requirements, while others — such as managing and securing workloads — introduce more complexity in terms of cost. There are many security and management tools as well as integrations with other cloud services that must be part of the calculations on total cloud costs. While flexibility and scalability increase in the cloud, these factors also influence overall spend, which can make cost control strategies more problematic.

It can also be difficult to track cloud spend when using containers as most organizations do. Managing cost controls for Kubernetes, as the de facto standard for container orchestration, can create added challenges since multiple applications can be “bin packed” and run on shared compute resources. A review of the bill from your cloud provider will not supply needed visibility into which team’s workload or application is being run in each Kubernetes cluster. This lack of visibility leads to the perception of Kubernetes as a black hole when it comes to cloud costs.

Consider a FinOps approach

To gain a better understanding of your cloud costs, consider adopting a FinOps approach. The FinOps Foundation describes FinOps as a practice that enables teams to manage their cloud costs, one in which everyone takes ownership of their cloud usage. A centralized best practices group supports the FinOps practice, and you can apply these principles to Kubernetes as well. Kubernetes service ownership, when DevOps gives developers the tools (and guardrails) they need to build, deploy, and own an application end to end, needs to include an understanding of overall cost management because configuration plays such a critical role in managing Kubernetes costs.

FinOps + Kubernetes cost control strategies

When teams adopt a FinOps / service ownership model of Kubernetes, it is essential to get an understanding of the cost of a workload. To gain clarity into the usage of cloud resources, teams frequently use a Kubernetes governance platform. A governance platform can supply policy-based control for cloud native environments, which enables service owners (specifically developers) the ability to make informed decisions about the finances of Kubernetes by allowing them to understand and adopt these six Kubernetes cost control strategies:

1. Workload cost allocation

Without insight into workload allocations, it is difficult to align reports to business context. Allocating and grouping cost estimates by namespace or labeling provides that insight.

2. Kubernetes cost optimization

Ensure that you have the visibility necessary to evaluate applications and clusters to help you find ways to reduce costs without affecting performance.

3. Right-sizing advice

Find solutions that help you maximize the efficiency of your CPU and memory utilization on Kubernetes workloads through monitoring. Effective monitoring solutions include advice on resource limits and requests, while Quality of Service recommendations can help you ensure that your apps scale as expected.

4. Kubernetes cost showback

Reporting is a critical aspect of Kubernetes cost control strategies, so make sure you can report your Kubernetes usage costs to the finance teams as well as distribute usage costs to developers so you can track savings over time.

5. Multi-cluster cost and usage

One of the biggest challenges in optimizing Kubernetes costs relates to cluster capacity and usage. Make sure you can gather information about how much of your cost and usage is spent on idle capacity, shared vs. app-specific resources, and the effectiveness of node scaling.

6. Cloud billing integration

To get accurate, usage-based cost data across your business, integrate your cloud bill (such as your AWS Cost and Usage Report)  to break down costs based on Kubernetes cluster, namespace, workload, and label.

A K8s governance platform can deliver these insights, which in turn enables a FinOps approach to Kubernetes and Kubernetes cost control strategies.

Monitor & optimize Kubernetes costs

Cloud spend is complicated and Kubernetes can make gaining visibility into overall spend even more difficult. Adopting a FinOps approach can help platform engineering leaders dramatically increase their visibility into Kubernetes spend. This approach, coupled with the right solutions, can help your organization understand and check costs, optimize compute and workloads, perform cost allocations, and set and review CPU and memory allocations to ensure apps are properly provisioned based on actual usage. Instead of an information vacuum, finance teams see how the budget is being allocated and spent — and how the engineering team has been able to identify savings and make their allocations more efficient over time. 

Want to learn more about Kubernetes cost control strategies? Read the Guide to Kubernetes Cost Optimization now.