Resource Recommender

Introduction

Resource Recommender is a Devtron feature that analyzes the historical resource usage (such as CPU and memory) of Kubernetes workloads in a specific cluster and generates data-backed recommendations for optimal resource allocation.

These recommendations are generated by a background job that runs daily at a particular time by default, using resource usage metrics collected from Prometheus. Job frequency can be customized by modifying the configuration in the ConfigMap. Refer Modify Resource Recommender Job Schedule to learn more.

It helps users eliminate manual guesswork, reduce over-provisioning, and prevent performance issues caused by under-provisioned workloads.

Prerequisites

  • Prometheus endpoint must be configured. Refer to the Cluster and Environments

Who Can Perform This Action?

Inspect Recommendations

To inspect the resource recommendations, follow the steps below:

  1. Navigate to Resource Browser.

    Figure 1: Navigating to Resource Browser
  2. Select the specific cluster for which you want to inspect the resource recommendations.

    Figure 2: Selecting Cluster
  3. Select the Resource Recommender tab to inspect the recommendations.

    Figure 3: Selecting Resource Recommender
    1. Each row displays workloads in that cluster, along with recommendations for CPU and memory.

      Figure 4: Displaying Workloads along with Recommendations
    2. Recommendations are shown as percentage changes by default. You can toggle Show absolute values to see current v/s recommended values in actual units (e.g., 128Mi → 4900Ki).

      Figure 5: Toggling 'Show Absolute Values'
  4. You can inspect the resource recommendations for each workload within the cluster.

    1. If you wish, you can filter the workloads based on their Kind and Namespace.

      Figure 6a: Filtering via 'Kind'
      Figure 6b: Filtering via 'Namespace'
    2. You can also search for a specific workload via the search bar based on kind, Namespace, API Version, and Workload.

      Figure 7: Filtering via Search Bar
  5. For each workload, recommendations can be of the following types:

Types of Recommendation

Type
Visual Indicator
Description

↑

Red upward arrow

Recommended value is higher than current

↓

Green downward arrow

Recommended value is lower than current

0% -

Gray dash (-)

Current value equals recommended

No Recommendation

No Recommendation

No recommendation available

Supported Resources

Type
Description

CPU REQUESTS

Minimum CPU allocated to the workload

CPU LIMITS

Maximum CPU allocatable to the workload

MEM REQUESTS

Minimum Memory (RAM) allocated to the workload

MEM LIMITS

Minimum Memory (RAM) allocatable to the workload

  1. Hover the cursor over the specific resource of the particular workload to view the recommendation.

    Figure 8a: Recommending for Increasing Resources
    Figure 8b: Recommending for Decreasing Resources
    Figure 8c: Recommending to not take any action
    Figure 8d: No Recommendation

Apply Recommendations

After inspecting the recommendations, you can directly apply them to your workloads. You can apply recommendations in the following ways

Apply Per Workload

To apply recommended resources to a specific workload, follow the steps below:

  1. Select the specific workload and click Apply Changes, or hover over the specific workload row and click the Apply button that appears on hover.

    Figure 9: Selecting Workload
  2. A modal window will open, displaying the comparison between the current and recommended resource values for that specific workload; review the recommended changes carefully.

    Figure 10: Comparing Configurations
  3. Click Apply Changes to update the resource configuration.

    Figure 11: Applying Changes

Bulk Apply

If you wish, you can apply recommended resource configurations to multiple or all workloads at once. To do so, follow the steps below:

  1. Select the workloads for which you want to apply recommended resource configurations and click Apply Changes.

    Figure 12: Selecting Workloads
  2. A modal window will open, displaying the comparison between the current and recommended resource values for each workload; review the recommended changes for each workload carefully.

    Figure 13: Comparing Configurations for each workload
  3. Click Apply Changes to update the resource configuration.

    Figure 14: Applying Changes

Export Recommendations in CSV File

You can also export resource recommendations to a CSV file. To do so, follow the steps below:

  1. Filter the workloads for which you want to export resource recommendations, based on their Kind and Namespace. By default, it will export resource recommendations for all workloads.

  2. Click the Download button; a dialog box appears asking you to choose the location where you want to save the file.

    Figure 15a: Clicking Download Button
    Figure 15b: Export Ready
  3. Select the location where you want to save the file.

  4. Click Save; the file will be saved at the selected location.

    Figure 16: Clicking 'Save'

Modify Resource Recommender Job Schedule

To modify the schedule of the Resource Recommender background job, follow the steps below:

  1. In a new tab, go to Resource Browser → (Select the Cluster for which you want to change modify resource recommender job schedule) → Config & Storage → ConfigMap

  2. Select the Orchestrator/Devtron ConfigMap

    1. If Devtron is managing your setup, contact Devtron support to perform these changes.

    2. If you installed Devtron via Helm, select devtron-cm and click Edit Live Manifest.

    Figure 17a: Selecting Devtron CM
    Figure 17b: Clicking 'Edit Live Manifest'
  3. Edit the KRR_SYNC_JOB_CRON_SCHEDULE key and set the schedule according to your use case using a cron expression.

  4. Click Apply Changes and manifest will be updated.

    Figure 18: Applying Changes
  5. Restart the orchestrator or devtron pod to implement the changes.

    Figure 19: Restarting Pods