HPA rightsizing

Overview

Komodor’s HPA Rightsizing capability enables automated resource rightsizing for workloads managed by a Horizontal Pod Autoscaler (HPA) while preserving the intended scaling behavior.

In standard Kubernetes configurations, HPA often scales workloads based on resource utilization relative to container resource requests. When rightsizing adjusts these requests, it can unintentionally affect HPA scaling decisions.

Komodor resolves this conflict by automatically modifying the HPA scaling metric, allowing rightsizing and horizontal scaling to operate together without triggering unintended scaling events.

With HPA Rightsizing enabled, Komodor:

  • Automatically optimizes CPU and memory requests

  • Maintains stable HPA scaling behavior

  • Prevents scaling feedback loops

How HPA Rightsizing Works

Enabling Rightsizing

When rightsizing is enabled for an HPA-managed workload:

  1. Komodor modifies the HPA scaling metric

  2. The metric changes from Utilization to AverageValue

  3. Once the mutation succeeds, rightsizing is applied to the workload pods

This ensures stable scaling behavior before resource requests are adjusted.

Disabling Rightsizing

When rightsizing is disabled:

  1. Komodor restores the HPA metric to the original utilization-based configuration

  2. Resource requests revert depending on the rightsizing configuration

If In-Place Rightsizing is Enabled

Running pods immediately revert to their original resource requests.

If In-Place Rightsizing is Disabled

  • Running pods retain right-sized requests until restart

  • Newly created pods use the original resource requests.

Identifying Mutated HPAs

Komodor annotates mutated HPAs for auditability.

Example annotations:

metadata:
annotations:
komodor.com/mutated: "true"
komodor.com/modified-by: policy-reconciler
komodor.com/modified-at: 2026-02-17T14:45:48.106162

The original configuration is also stored:

komodor.com/original-metrics: '<original metrics configuration>'

These annotations allow you to track which HPAs were modified by Komodor.

GitOps Compatibility

HPA Rightsizing supports common GitOps workflows.

ArgoCD

ArgoCD requires a configuration adjustment to allow Komodor to patch HPA resources.

Add the following configuration:

resource.customizations.ignoreDifferences.all: |
managedFieldsManagers:
- komodor-rightsizing-controller

FluxCD

FluxCD is supported out of the box, including:

  • Helm releases

  • Kustomize deployments

Komodor also performs GitOps safety validation to ensure the HPA mutation persists before applying rightsizing changes.

 

 

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.