Skip to content

[VPA] Allow in-place updates when replica group is below minReplicas (InPlaceOrRecreate); block eviction fallback #9157

@ortherion

Description

@ortherion

Which component are you using?:
/area vertical-pod-autoscaler

Is your feature request designed to solve a problem? If so describe the problem this feature should solve.:

With VPA updateMode: InPlaceOrRecreate, replica groups that have fewer live pods than minReplicas (e.g. a single pod when --min-replicas=2) never get recommendations applied. The updater skips such groups in GetCreatorMaps (if actual < required { continue }), so they are not in the maps and neither in-place nor eviction is considered. Users with single-replica or small replica sets cannot receive VPA updates without lowering minReplicas or increasing replica count, even though in-place resize does not reduce the number of pods and would be safe.

Describe the solution you'd like.:

  • When livePods < minReplicas, still include the replica group in the updater maps and mark it with a flag (e.g. belowMinReplicas in group stats).
  • Eviction (recreate): keep it blocked for groups below minReplicas — in the eviction path (e.g. PodsEvictionRestrictionImpl.CanEvict), return false when the group is below minReplicas and log it.
  • In-place: allow in-place resize for these groups — the in-place restriction logic does not consider the “below minReplicas” flag, so in-place updates can proceed when the node supports it.
  • If in-place is not possible (e.g. resize Infeasible), do not fall back to eviction when below minReplicas; only log and skip.

Result: with InPlaceOrRecreate, single-replica and small replica sets can receive VPA recommendations only via in-place resize; eviction/recreate remains forbidden when below minReplicas.

Describe any alternative solutions you've considered.:

  • Removing the actual < required check entirely: would allow eviction for groups below minReplicas and reduce availability, so rejected.
  • Per-VPA minReplicas=1 for singletons: users can set spec.updatePolicy.minReplicas: 1 today, but then eviction would also be allowed for that one pod; the goal is to allow only in-place for below-minReplicas groups, not eviction.
  • New update mode (e.g. “InPlaceOnly”): would add API surface and overlap with “allow in-place below minReplicas for InPlaceOrRecreate”; the proposed change is a small, backward-compatible fix in updater restriction logic.

Additional context.:

  • Affected code: vertical-pod-autoscaler/pkg/updater/restriction/ (factory, eviction restriction, in-place restriction).
  • In-place resize does not change the number of pods, so allowing it below minReplicas does not reduce availability; only eviction/recreate needs to stay blocked.
  • Implementation adds a boolean (e.g. belowMinReplicas) to group stats, set in GetCreatorMaps when actual < required, and checked only in the eviction path.

Metadata

Metadata

Assignees

Labels

area/vertical-pod-autoscalerkind/featureCategorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions