Jump to Content
Containers & Kubernetes

4 low-effort, high-impact ways to cut your GKE costs (and your carbon footprint)

November 10, 2022
https://storage.googleapis.com/gweb-cloudblog-publish/images/containers_2022_anH39my.max-2500x2500.jpg
Roman Arcea

Product Manager, GKE

Gari Singh

Product Manager

Try Google Cloud

Start building on Google Cloud with $300 in free credits and 20+ always free products.

Free trial

Controlling cloud costs is always top-of-mind for organizations. But how? It can be difficult to surface wasted resources and figure out how best to optimize them without sacrificing performance or availability.

Here on the Google Kubernetes Engine (GKE) team, we’re eager to help in any way we can. And after participating in some recent capacity planning exercises of our own, we couldn’t help but notice that there are some low-hanging fruit when it comes to optimization opportunities: According to our internal research, up to one in ten of clusters across the GKE fleet is idle at any given time. Further, among over-provisioned workloads, 40% of them have provisioned 30 times the resources they actually use — and 11% of workloads have provisioned over 100 times the needed resources. 

Thankfully, there are many best practices for reclaiming this wasted capacity, many of which we’ve built directly into GKE. Read on for four low-effort, high-reward ways to reclaim resources and optimize your GKE spend. As an added bonus, when you reclaim wasted resources and implement these techniques, you’re also minimizing management overhead — and reducing your carbon footprint!

Let’s dive in.


Strategy 1: Activate the ‘optimize-utilization’ profile in the GKE cluster autoscaler

Level: Easy 
Impact: Medium

Rightsizing vCPU and memory is one of the primary ways to save on GKE costs. The online UK-based, carpooling marketplace BlaBlaCar recently went through the process and saw their CPU utilization go from 25% to 53%. GKE provides several built-in tools to help you do the same. For example, GKE cluster autoscaler supports several mechanisms for automatically resizing a cluster’s node pools based on the demands on your workload, which you can apply by specifying an autoscaler profile. After analyzing our customers’ clusters across the GKE fleet, we estimate that activating the optimize-utilization profile can reduce unallocated vCPU and memory by 20% on average. For most clusters, it is a flip of a switch that has no impact on application behavior or performance, but that could significantly reduce the number of vCPUs and/or VMs that you need.

Steps you should take:

  • Learn about the optimize-utilization profile by watching this video guide.

  • Read the documentation to learn how to activate it.

  • Activate it on your existing (and new) clusters.

https://storage.googleapis.com/gweb-cloudblog-publish/images/1_GKE_costs.max-1000x1000.jpg
Note: The cluster autoscaler optimize-utilization profile is designed to reduce cluster costs with minimal disruption or friction to your workloads. We don’t, however, recommend it for clusters with applications that go through consistent resource utilization spikes and/or have long startup and preparation times.

....reduce unallocated vCPU and memory by 20% on average.


Strategy 2: Shut down idle clusters

Level: Easy 
Impact: Medium-High

Turn off what you’re not using. This is a no-brainer, yet, among the GKE clusters that users are running, we found one in ten clusters are potentially running idle at any given time. While there’s no one definition of an idle cluster, these clusters:

  • Aren’t running any pods

  • Are out of date and about to lose connectivity to the control-plane nodes

  • Haven’t had any API interaction and object changes for a long time

  • Have had no changes to pod count and are running at very low utilization levels

Shutting down an idle (or near-idle) cluster is easy:

First, review the “GKE Active/Idle clusters” sample dashboard in Cloud Monitoring and confirm which of your clusters are indeed idle or significantly underutilized.

For this, go to Cloud Monitoring -> Dashboard -> Sample Library and in Categories, select Google Kubernetes Engine. The “GKE Active/Idle clusters” are available in the sample list of the dashboard.

Once you confirm the cluster state, proceed to shutdown the cluster using your preferred method.

https://storage.googleapis.com/gweb-cloudblog-publish/images/2_GKE_costs.max-1400x1400.jpg

…one in ten clusters are potentially running idle at any given time.


Strategy 3: Establish an optimization and rightsizing routine

Level: Easy 
Impact: Medium-High

Poorly sized clusters and workloads create a significant amount of waste. As we pointed out above, among over-provisioned workloads, our internal research found 40% of them have provisioned 30 times the resources they actually use — and 11% of workloads have provisioned over 100 times the needed resources. 

GKE has you covered, with multiple tools to help you rightsize your clusters:

  • Check GKE’s built-in cost insights to quickly locate the clusters and workloads that would make the most difference if rightsized. 

  • Then, use GKE’s new, built-in workload rightsizing capability to get guidance on how to vertically rightsize your deployments.

  • If you’re happy with GKE’s workload rightsizing suggestions, consider activating the vertical pod autoscaler to automate the process and reduce operational effort.

To learn more, check our best practices and video guide on GKE autoscaling.

40% of over-provisioned workloads have 30 times the requested resources they actually use.


Strategy 4: Move to GKE Autopilot

Level: Easy-Medium 
Impact: High

Sure, reducing the cost of your infrastructure is important, but reducing your operations costs may be even more valuable, allowing you to free up valuable engineering talent, while helping you benefit from a more stable and secure environment.

This is what you get with GKE Autopilot mode of operation. Because it’s priced per pod resource request rather than by provisioned infrastructure, GKE Autopilot can achieve instant cost savings for the simple reason that you won’t get charged for any unused infrastructure that you provision. GKE Autopilot also eliminates one of the more important sources of waste and effort: inefficient bin-packing. And because GKE Autopilot implements configuration best practices by default, you need less Kubernetes expertise to set up your environment correctly, so spend less time managing the system. 

On the basis of list price alone, GKE Autopilot might seem more expensive on a core/hour basis, but your reality might be different. When we looked across the entire GKE fleet, we found that as much as 45% of all clusters would be cheaper if they were migrated to GKE Autopilot today.

Want to get started with GKE Autopilot?

45% of all clusters would be cheaper if they were migrated to GKE Autopilot today.


How low did your GKE costs go?

Here at Google Cloud, we’re passionate about making it easy for you to set up, run and manage your environment easily and cost-effectively. By implementing these four strategies today, we believe you will see a noticeable change in your GKE bill, as soon as next month! Even better, you’ll lessen the load on your GKE administrators — and you may even see a reduction in your carbon footprint. Share the results  of your GKE optimization efforts with us and the world on social media by using the hashtag #GKEoptimized.

Posted in