Best Practice

Establishing a Kubernetes cost management strategy

Many organizations are making the switch to Kubernetes for the promise of greater speed, and reduced costs. But controlling spend requires close attention to what's happening in your services and resources. Cortex helps organizations keep costs in check with Catalogs, Scorecards, and Initiatives.

By
Lauren Craigie
-
August 16, 2023

Kubernetes (k8s) adoption has skyrocketed since its 2014 introduction, becoming one of the most popular open source container orchestration platforms for its power and flexibility. K8s reduce costs by improving efficiency, optimizing resource use, and eliminating redundancies. But cost savings in Kubernetes can be tricky to maintain. In fact, a 2021 survey of 178 organizations showed that costs associated with k8s can actually increase from insufficient monitoring, resulting in overspend. To ensure you're capturing all of the expected benefits of k8s, it’s important to keep a close eye on your services and resources. In this blog we’ll share how Internal Developer Portals (IDPs) like Cortex can help.

The challenges of Kubernetes cost management

Successfully implementing an effective Kubernetes cost management strategy is a complex undertaking that requires close collaboration between team members, especially those in engineering and finance.

Three of the main reasons why Kubernetes cost management can be challenging are:

  • Complexity: Applications deployed in Kubernetes use a multitude of different resources, such as pods, deployments, and namespaces. These applications are sometimes shared by teams and spread across clusters and environments. This degree of complexity makes it difficult to track and attribute costs to the correct sources.
  • Abstraction: For better or for worse, the Kubernetes API abstracts away much of the complexity described above. Although this can make the platform easier to use, it also reduces visibility into what’s happening under the hood. Limited visibility means usage is more likely to get out of hand and go undetected.
  • Volatility: Resource usage can be highly volatile due to the way in which Kubernetes automatically creates and dumps container instances on an as-needed basis, similarly making it difficult to accurately track usage levels.

Establishing a cost management strategy

There are several techniques that help organizations manage their Kubernetes costs effectively, but one of the most important factors is visibility. After all, costs can’t be managed if they aren’t measured. To do this, organizations should monitor their services to identify components that are responsible for excessive resource usage at a granular level. These metrics can provide insight into appropriate usage limits, quotas, and alert thresholds to keep costs in check. With adequate monitoring, you’ll also be better equipped to understand the impact certain changes or trends have on costs and make informed decisions accordingly.

Architecturally, reducing nodes is one of the most effective ways to lower Kubernetes costs. To do this, you can leverage horizontal autoscalers, vertical autoscalers, and cluster autoscalers to dynamically adjust the number and sizes of nodes and pods. Additionally, reducing traffic between different regions and availability zones can minimize unnecessary data transfer costs. 

Above all, it’s important for organizations to align on best practices. Procedures and processes should be clearly documented, and it can even be helpful to provide internal training for team members and stakeholders to learn about and adopt cost management practices. Building a culture of cost management into your organization will help ensure that you reap the financial benefits of Kubernetes over the long term.

How Cortex can help 

Cortex is an Internal Developer Portal that integrates with Kubernetes to provide visibility into how your services and infrastructure relate to Kubernetes deployments. With the Cortex Catalog, Scorecards, Initiatives, and Scaffolder, you can both reduce migration time and ensure new and existing services align with cost-saving best practice.

1.Catalog: When switching to a microservice-supported architecture like Kubernetes, it’s important to keep close track of the services themselves. Redundant services and/or services without clear ownership or purposes are inefficient and contribute to overspending. Service catalogs, which audit everything in an organization’s environment (and provide crucial information such as who owns a service and what it does) can be instrumental in managing services and costs alike.

From the service detail page, Cortex users can see information from integrations like Datadog, Git, Jira, and Kubernetes.

Service detail page in Cortex

From here, they can drill into cluster details to access information about active replicas, currently deployed versions, and resource requirements. 

View of Kubernetes detail under Cortex catalog pages

2. Scorecards & Initiatives: Cortex’s Scorecard feature also allows teams to leverage the aforementioned details when creating standards for Kubernetes best practice like monitoring, autoscaling, and any other cost-saving measures the team has identified. Cortex Initiatives enable teams to slice off priority measures from Scorecards to add deadlines and alerting.

Section of Scorecard in Cortex where rules can be viewed

3. Scaffolder: Cortex's Scaffolder can then be used to create boilerplate code for k8s-native services.

Section of Scaffolder template in Cortex

Bringing it all together to speed your k8s migration timeline

Just the process of moving to Kubernetes can be both expensive and time-consuming, with many migrations slated for multi-year timelines. Cortex can significantly reduce migration timelines when users leverage Scorecards and Initiatives to automatically identify progress against migration markers, as well as notify developers when they’re approaching deadlines for cutover. Using Cortex in this way helped LetsGetChecked shave 8 months off their migration timeline.

To learn more and see how Cortex can help accelerate your Kubernetes migration, book a demo today.

Best Practice
By
Lauren Craigie
What's driving urgency for IDPs?