Container Request Right-Sizing Recommendations

The container request right-sizing recommendations page shows containers which would benefit from changes to their resource requests. It additionally provides convenient options to automate the application of those recommendations. Using container request right-sizing allows you to optimize resource allocation across your entire cluster. You can easily eliminate resource over-allocation in your cluster, which paves the way for vast savings via cluster right-sizing and other optimizations.

To access the container request right-sizing recommendations savings page, select Savings in the left navigation pane, then select Right-size container requests.

Resource requests in Kubernetes are guarantees about resources made available from nodes to pods. They function effectively as reservations on capacity. With requests in place, Kubernetes will only schedule a pod to a node if the node has the available capacity. Defining requests is beneficial in that it increases the pod quality of service priority from BestEffort to Burstable, helpful when nodes come under pressure and some pods must be selected for eviction. From a cost perspective, ensuring that requests are always kept within an appropriate range is important. Requesting too much capacity while not consuming it means other pods cannot use the available capacity, increasing costs to run a set of workloads as potentially more, or larger, nodes are needed to run available pods.

For more details on how requests and limits function in Kubernetes, see the Kubecost blog post Kubernetes Requests and Limits: A Practical Guide and Solutions.

The container request right-sizing recommendations page shows a tabular view of containers and their pod controllers being monitored by Kubecost along with recommendations for the resource requests. Each row represents a container where the pod controller kind and name is shown, therefore duplicate values indicate multiple containers in the same pod or pod controller have recommendations. The page offers options to sort the recommendations by CPU and RAM dimensions such as average and maximum usage, recommended requests, and current requests.

Recommendations from Kubecost can including both increasing, decreasing, as well as establishing net new resource requests. When Kubecost recommends a decrease in resource requests, this results in savings opportunities. The EST. SAVINGS field (Estimated Savings) shows the estimated amount of monthly savings which can be achieved by adopting the recommendations. The amount of estimated savings depends on the Profile and other configuration options which are explained below. The container request right-sizing recommendations table is sorted by default in descending order according to the estimated savings available.

The CURRENT EFFICIENCY field shows the efficiency of the container as a result of its current usage-to-request ratio factoring in both CPU and memory. Efficiencies at or above 100% usually indicate the container is undersized in one or both resources and Kubecost recommends increasing requests.

Expand one of the rows to see more details on the workload and the recommendations offered by Kubecost. This view shows more information about the workload, including details such as the namespace and container name, along with the current request values and Kubecost's recommendations. The recommendations displayed in this view are also a result of the configuration options explained below.

By clicking a row instead of expanding it, the Workload Savings screen opens to that container. In this view, more details are provided on the container and requests along with an ability to view all associated labels and a link to view the observed utilization metrics for yourself in Grafana (if deployed).

Prerequisites

While there are no restrictions to provide/view container request right-sizing recommendations, in order for Kubecost to apply those recommendations the Cluster Controller component is required. You must deploy Cluster Controller to the cluster(s) where Kubecost will apply any recommendations.

Configuring request right-sizing recommendations

Select Customize to modify the right-sizing settings. Your customization settings will tell Kubecost how to calculate its recommendations, so make sure it properly represents your environment and activity:

  • Window: Duration of deployment activity Kubecost will observe.

  • Profile: Select from Development, Production, or High Availability, which come with predefined values for CPU/RAM target utilization fields. Selecting Custom will allow you to manually configure these fields.

  • CPU/RAM recommendation algorithm: Set to Max when any non-custom profile is in use. Additional algorithms include percentile of average and percentile of max.

  • CPU/RAM target utilization: Used along with the recommendation algorithm to determine the final value used for the new requests. For example, when the recommendation algorithm is configured for Max, a target utilization of 0.8 and a maximum CPU usage of 1.2 CPUs will result in a recommendation of 1.5 CPUs (1,500m). This is because 1.2 CPUs (the maximum) is 80% of 1.5 CPUs (the recommendation). Mathematically, this can be expressed as 0.8(x) = 1.2.

  • Add Filters: Optional configurations to limit the returned request right-sizing results. Multiple filters are supported.

When finished, select Save.

Regardless of how the recommendations are configured or how low the observed utilization is, Kubecost has a minimum recommendation threshold of 10m for CPU and 20Mi for RAM.

Your configured recommendations can also be downloaded as a CSV file by selecting the meatballs menu followed by Download CSV.

Adopting request right-sizing recommendations

There are several ways to adopt Kubecost's container request right-sizing recommendations, depending on how frequently you wish to utilize this feature for your container requests. Note that although Kubecost will show containers from multiple different pod controllers, only deployments are supported when it comes to applying recommendations.

One-click right-sizing

To apply container request right-sizing recommendations on-demand based on the current results of the page, select Resize Requests Now and click the Yes, apply the recommendation button. The new request values as shown in the current view will be applied.

Autoscaling

Autoscaling allows you to automatically apply container request right-sizing recommendations periodically based upon a schedule to the available deployments. You can configure this by selecting Enable Autoscaling, selecting your Start Date and schedule, then confirming with Apply.

Savings Actions

These and other automated savings opportunities can also be configured via Savings Actions. See the Actions documentation for more details.

Last updated