Jump to Content
Containers & Kubernetes

Maximizing reliability, minimizing costs: Right-sizing Kubernetes workloads

August 7, 2023
Ameenah Burhan

Solutions Architect

Anthony Bushong

Developer Relations Engineer

Do you know how much money you could save by adjusting workload requests to better represent their actual usage? If you're not rightsizing your workloads, you might be overpaying for resources that your workloads aren't even using or worse, putting your workloads at risk for reliability issues due to under provisioning.

https://storage.googleapis.com/gweb-cloudblog-publish/images/01_rightsize.max-2200x2200.png

As we've previously discussed, setting the resources is the most important thing you can do to increase the reliability of your Kubernetes workloads. In this blog we will help you with the second key finding from the State of Kubernetes Cost Optimization report!

The research … found that workload rightsizing has the biggest opportunity to reduce resource waste.

State of Kubernetes Cost Optimization report

According to our research findings, workload rightsizing is the most important golden signal. Workload rightsizing measures the capacity of developers to properly use the CPU and memory they have requested for their applications. 

Rightsizing is challenging

It can be quite difficult to predict the resource needs of your applications, which historically has not been a concern for developers in traditional data center environments.In traditional data center environments, resources were typically over-provisioned upfront to ensure capacity for peak demand and future growth, so developers didn't need to focus on accurately predicting resource needs as they were covered by the excess capacity, whereas in cloud environments, resources are consumed on-demand. Finding a balance between efficiency and reliability can often feel like a delicate balancing act.

Tools for workload rightsizing

There are native tools in Cloud Monitoring and the GKE UI you can use to rightsize your workloads running on GKE. 

Rightsizing in the console

The Workload Cost Optimization tab helps you identify workloads that can be optimized by displaying the resources used versus what’s requested.

https://storage.googleapis.com/gweb-cloudblog-publish/images/02_rightsize.max-1900x1900.png

To take advantage of potential cost savings, you can drill into clusters to see workload level resource recommendations.

To view workload resource recommendations for Deployment objects only:

In the GKE Cost Optimization.

Select a cluster.

Click Workloads > Cost Optimization.

Select one Deployment workloads

In the workload’s detail page, select Actions > Scale > Edit Resource Requests

Rightsizing with Cloud Monitoring

Cloud Monitoring provides built-in VPA scale recommendations metrics that you can use to monitor the performance of your workloads and to identify opportunities to rightsize them without the need to create VPA objects.

https://storage.googleapis.com/gweb-cloudblog-publish/images/03_rightsize.max-2200x2200.png

To view these metrics:

1. Go to the Cloud Monitoring > Metric Explore console.

2. In the Metric dropdown, select the metrics:

Memory recommendations: 
Kubernetes Scale > autoscaler > Recommended per replica request bytes

CPU recommendations: 
Kubernetes Scale > autoscaler > Recommended per replica request cores

Rightsizing at scale

If you’re interested in viewing recommendations across clusters and projects, We've created a guide that you can use today to help you right-size your GKE workloads at scale. This solution leverages your actual cluster’s metric data and built-in workload recommendations provided by Cloud Monitoring. You can determine the resource requirements for all your workloads without having to create additional VPA autoscaler objects in each of your clusters. The guide walks you through deploying the solution.

https://storage.googleapis.com/gweb-cloudblog-publish/images/04_rightsize.max-2200x2200.png

In conclusion

In conclusion, rightsizing your workloads is essential for both cost savings and reliability. By following the tips in this blog, you can ensure that your workloads are using the right amount of resources, which will save you money and increase your workload's reliability.

Links to the solution presented in this blog and other useful tools to help you optimize your cluster are listed below:

The Right-sizing workloads at scale solution guide

Setting resource requests: the key to Kubernetes cost optimization

The simple kube-requests-checker tool

An interactive tutorial to get set up in GKE with a set of sample workloads

Download the State of Kubernetes Optimization report, review the key findings, and stay tuned for our next blog post!

Posted in