Flexibility is one of Kubernetes’ greatest strengths, but it can become a weakness if left unmanaged. The decentralized nature and rapid scale of the public cloud can easily lead to cloud spending that exceeds expectations and actual needs. Organizations struggle not only with overspending, but also with evaluating cloud spend accurately and efficiently. This is especially true with Kubernetes due to the complexity and scale of Kubernetes cloud costs.
As organizations mature their cloud strategies, they frequently look to optimize their cloud spending. Cloud financial management, or FinOps, is the operational practice of managing the financial implications of public cloud usage. Organizations practicing FinOps adapt their operational processes to take advantage of the financial benefits of the cloud and maximize their return on investment. Ultimately, FinOps is all about aligning cloud investments to strategic business goals, and optimizing along the way.
Applying FinOps to Kubernetes is a key part of this puzzle and requires an approach that’s tailored to the unique challenges of managing Kubernetes costs. In this post, we’ll discuss effective strategies for extending FinOps practices to Kubernetes that will maximize the impact of the organization’s investment in the technology.
The foundations of FinOps
Success with FinOps begins with building a culture of financial accountability in the cloud.
There are multiple steps organizations can take to secure buy-in from all the different teams responsible for cloud spending. Providing visibility is a natural starting point, and can typically take the form of a snapshot showing how teams rank in their level of optimization or educating teams on opportunities to optimize.
Another approach is to evolve from showback to chargeback: starting by sending an invoice to departments with their spend over time and progressing to giving them direct financial responsibility for these costs. Tagging spend is an important prerequisite to implementing this strategy. Finally, gamification in terms of reports that track teams’ progress over time can contribute to driving a cost-centric culture.
The unique challenges of FinOps for Kubernetes
FinOps for Kubernetes begins with actually understanding the true costs of your workloads. For public cloud, Kubernetes stacks are delivered as a service, but organizations must still understand these costs across multiple public cloud vendors. In the private cloud, organizations are responsible for providing their own insights into the costs of running a Kubernetes stack, including hardware, software, and labor.
Digging a level deeper, FinOps should spark every organization to interrogate their cloud spending practices. We’ve collected five questions that organizations should ask about their Kubernetes spending.
- What are our KPIs? The first step to optimizing Kubernetes financial cloud management is to ensure different teams understand shared KPIs and report on the same metrics.
- How do we connect the dots between our application constructs and our KPIs? It’s essential to standardize on definitions and labels in an organization’s Kubernetes cloud infrastructure in order to ensure consistency and governance.
- How do we allocate the costs of our cloud services? Kubernetes enables developers to use resource requests to control the amount of resources per pod or container. From there, they can choose whether to think about allocating costs by either the amount that was provisioned or by the amount that was used.
- Who pays for common services? A Kubernetes cluster will have core services such as a control pane or a log service that various teams benefit from. Organizations must choose whether these costs should be split across teams evenly, proportional to usage, or perhaps from a separate central cost center.
- What are my optimization opportunities? Finally, organizations can look at the steps they can take to optimize Kubernetes spend. Let’s break these areas down in the following section.
Best practices for optimizing Kubernetes cloud costs
Once an organization has gone through the exercises above to create a framework for standardizing, classifying, and measuring Kubernetes cloud costs, they can think about how to optimize these costs. We’ve broken the different opportunities for optimization down into five categories.
- Pod rightsizing: Provide enough resources for optimal performance, but not so much that there’s waste. Examine your pod usage and application performance over time to determine if you can rightsize your pods by adjusting your requests and limits.
- Node rightsizing: Similar to rightsizing pods, it’s important to make sure you’re using the right size and type of node for the workloads you’re running. Be sure to measure what applications require and reduce the number and size of nodes where possible.
- Autoscaling: It’s challenging to know the exact number of pods or nodes that best fit the services you’re running and to adapt quickly when changes occur. Kubernetes offers autoscaling capabilities to ensure the use of the right size and number of pods, nodes, and clusters. These tools include The Horizontal Pod Autoscaler (HPA) or The Cluster Autoscaler.
- Rebalancing fragmented Kubernetes nodes: Since Kubernetes schedulers cannot predict future pod sizes and node additions, inconsistencies develop in the way pods are scheduled. Pods are eventually scheduled across nodes in such a way that for any new pod, all the resources requested by it are collectively unavailable at any single node, making the pod un-schedulable. Even though an overall cluster might have much more capacity available across the nodes, a scale-up is still needed. This creates a “pseudo” resource crunch that could be avoided by consolidating these fragments of available resources together. In sum, rebalancing Kubernetes clusters is about implementing the previous best practices in an integrated way and on an ongoing basis.
- Leveraging efficient purchasing options: Major cloud providers offer different resource purchasing options, including discounted price options for modified service contract terms. These options apply to Kubernetes just as they would to non-containerized infrastructure, providing opportunities for reducing costs.
Containers are revolutionizing how applications are developed and deployed. However, optimizing your Kubernetes cloud costs is a unique challenge that requires an approach tailored to the technology. Applying FinOps to Kubernetes should ultimately help organizations optimize container environments and save money without sacrificing agility. This ensures developers can focus on innovation and delivering new solutions, while the organization maximizes their return on technology investment.
Learn how CloudHealth can help you manage your Kubernetes environments by reading our solution brief, or book a demo to see the CloudHealth Platform in action.