Fairwinds | Blog

Kubernetes Best Practice for Efficient Resource Utilization

Written by Daniel O'Sullivan | Apr 9, 2020 3:27:27 PM

We all know that we need to manage Kubernetes efficiently. It’s similar to how we all know we need to drive our cars more efficiently. But we cannot simply do this just by checking the fuel gauge, we need to change our driving habits. The same holds true for Kubernetes. We cannot simply monitor resource utilization, we must change how workloads are configured to increase efficiency.  

Kubernetes Best Practices: Maximizing Efficiency

Kubernetes’ concepts of resource limits and requests allow for efficient resource utilization, when properly used. However, it can be difficult to know what values to use when configuring resource limits and requests for your workloads. In this blog post, we’ll show you how to easily find those values using Goldilocks, an open source tool from Fairwinds. 

Set Kubernetes Limits and Requests the RIGHT way

Setting your requests and limits too low on an application will cause problems. For example, if your memory limits are too low, Kubernetes is bound to kill your application for violating its limits. 

Meanwhile, setting your requests and limits too high results in resource overallocation. You waste resources and end up with a higher bill.  

Because it can be tricky to dial these settings in, some teams never set requests or limits at all, while others set them too high during initial testing and then never course correct.

So how do you know what the right limits and requests are for your Kubernetes cluster? Traditionally, it has required a fair amount of trial and error. However, to speed up this process, Fairwinds developed Goldilocks. 

Goldilocks: Open Source Tool for Kubernetes Efficiency

Goldilocks is a free open source tool that helps teams allocate resources to their Kubernetes deployments and get those resource calibrations just right. 

Goldilocks is a Kubernetes controller that collects data about running pods and provides recommendations on how to set resource requests and limits. It can help organizations understand resource usage, resource costs, and best practices around efficiency of usage.

Goldilocks, an open source tool for Kubernetes, helps you understand resource usage and cost so you can implement K8S best practices around efficiency. 

[Click to tweet]

Goldilocks employs the Kubernetes Vertical Pod Autoscaler (VPA). It takes into account the historical memory and CPU usage of your workloads, along with the current resource usage of your pods, in order to recommend how to set your resource requests and limits. (While the VPA can actually set limits for you, it is often best to use the VPA engine only to provide recommendations.) Essentially, the tool creates a VPA for each deployment in a namespace and then queries that deployment for information.

If building healthy, efficient Kubernetes deployments is a challenge for you, then definitely check out Goldilocks. 

You can read more best practices for k8s efficiency by checking out how to enable resource recommendations and better understand the balance of your workloads.