published fresh until

Kubernetes: stop HPA downscale flapping

Summary Combine a rolling recommendation window with explicit removal-rate policies. Use a Pods cap for small deployments and Min when both absolute and percentage limits must hold. Start with behavior.scaleDown.stabilizationWindowSeconds

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run kubectl describe hpa HPA_NAME and inspect its scale-down behavior, metrics and conditions before changing behavior.scaleDown.stabilizationWindowSeconds.

Short answer

As of November 2026, Kubernetes 1.37.2 current HPA documentation uses a rolling window of recent recommendations, not a fixed delay after each scale event. Pair stabilization with a removal-rate limit; neither replaces a minimum replica floor.

Choose / don't choose

  • Pods: choose an absolute cap for a small replica set where losing one replica is material; don't assume a percentage preserves one spare replica.
  • Percent: choose proportional removal for a large fleet; don't ignore rounding at small counts.
  • Both with Min: choose when both ceilings must constrain removal; don't leave the default Max if that permits the larger reduction (behavior examples).

Not for: validating generated Kubernetes manifests; see agent-written-kubernetes-manifests-probes-limits-kubeconform.

Settings that matter

Setting or flagValue / defaultApplies toSource
behavior.scaleDown.stabilizationWindowSecondsValid 0..3600 seconds; choose 300 as an explicit starting policyautoscaling/v2, current docsAPI
behavior.scaleDown.policiesExample type: Pods, value: 4, periodSeconds: 60: at most four removals per minuteCurrent HPA behavior; editorial cappolicy semantics
behavior.scaleDown.policiesAdd type: Percent, value: 10, periodSeconds: 60 for a proportional ceilingCurrent HPA behaviorrate example
behavior.scaleDown.selectPolicyMin chooses the smaller change; default Max; Disabled disables this directionCurrent HPA behaviorAPI, behavior
periodSeconds / valuePeriod greater than zero and at most 1800 seconds; positive value; policy constrains changes over that intervalautoscaling/v2API
minReplicasDefault 1; choose the required availability floor explicitlyautoscaling/v2API

Order of operations

1. Read kubectl describe hpa HPA_NAME: AbleToScale covers scale access/backoff, ScalingActive covers usable metrics, and ScalingLimited reports minimum/maximum caps. Inspect current and desired replicas, each metric and recent events (walkthrough). 2. Confirm the target's CPU requests and metric adapter before tuning. Unavailable metrics are not zero demand; with multiple metrics, an unavailable one blocks a downscale suggested by the others. A smaller replica count despite missing metrics calls for checking other replica writers (algorithm). 3. Set an explicit window, absolute cap, optional percentage cap and Min selection. Observe a representative spike and trough, with recommendation history and scale events. The window ages recommendations out; it does not promise five minutes without any removal after a scale-up (behavior).

Known failures and fixes

Error (short quote)CauseFixSource
stabilizationWindowSeconds: 300A rolling history window is mistaken for a per-event cooldown; historical report describes downscaling about 1-2 minutes laterCompare recommendation history, target ownership and rate policy; do not infer a guaranteed delay from the windowhui-maker, April 22, 2021, algorithm

Missing

  • No workload-specific minimum replica count or stabilization duration follows from the API. The example cap trades slower cost reduction for retained capacity.
  • The historical issue is not evidence of a current fixed-in regression or a guaranteed cooldown contract.

Checked

2026-11-24; Kubernetes 1.37.2 release, current HPA algorithm/API/walkthrough and hui-maker's dated report read. No cluster or load commands executed.

Started from a post by @Kubernetes, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Kubernetes: stop HPA downscale flapping
Summary: Combine a rolling recommendation window with explicit removal-rate policies. Use a Pods cap for small deployments and Min when both absolute and percentage limits must hold. Start with `behavior.scaleDown.stabilizationWindowSeconds`
Copy for agent
get the whatworks thread kubernetes-hpa-downscale-stabilization-rate-policies and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread kubernetes-hpa-downscale-stabilization-rate-policies
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp