Skip to content

Commit 99a4206

Browse files
authored
Merge pull request #53395 from iamzili/add-LimitRange-vpa
add LimitRange section, make small improvements to the VPA write-up
2 parents 221371a + 6cba428 commit 99a4206

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

content/en/docs/concepts/workloads/autoscaling/vertical-pod-autoscale.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Figure 1. VerticalPodAutoscaler controls the resource requests and limits of Pod
9191

9292
Kubernetes implements vertical pod autoscaling through multiple cooperating components that run intermittently (it is not a continuous process). The VPA consists of three main components:
9393

94-
* The _recommender*, which analyzes resource usage and provides recommendations.
94+
* The _recommender_, which analyzes resource usage and provides recommendations.
9595
* The _updater_, that Pod resource requests either by evicting Pods or modifying them in place.
9696
* And the VPA _admission controller_ webhook, which applies resource recommendations to new or recreated Pods.
9797

@@ -100,7 +100,6 @@ Once during each period, the Recommender queries the resource utilization for Po
100100
The Recommender analyzes both current and historical resource usage data (CPU and memory) for each Pod targeted by the VerticalPodAutoscaler. It examines:
101101
- Historical consumption patterns over time to identify trends
102102
- Peak usage and variance to ensure sufficient headroom
103-
- Current resource requests compared to actual usage
104103
- Out-of-memory (OOM) events and other resource-related incidents
105104

106105
Based on this analysis, the Recommender calculates three types of recommendations:
@@ -119,9 +118,7 @@ The chosen method depends on the configured update mode, cluster capabilities, a
119118

120119
The _admission controller_ operates as a mutating webhook that intercepts Pod creation requests. It
121120
checks if the Pod is targeted by a VerticalPodAutoscaler and, if so, applies the recommended
122-
resource requests and limits before the Pod is created. This ensures new Pods start with
123-
appropriately sized resource allocations, whether they're created during initial deployment,
124-
after an eviction by the updater, or due to scaling operations.
121+
resource requests and limits before the Pod is created. More specifically, the admission controller uses the Target recommendation in the VerticalPodAutoscaler resource's `.status.recommendation` stanza as the new resource requests. The admission controller ensures new Pods start with appropriately sized resource allocations, whether they're created during initial deployment, after an eviction by the updater, or due to scaling operations.
125122

126123
The VerticalPodAutoscaler requires a metrics source, such as Kubernetes' Metrics Server {{< glossary_tooltip text="add-on" term_id="addons" >}},
127124
to be installed in the cluster.
@@ -158,7 +155,7 @@ You can use a tool such as `kubectl` to view the `.status` and the recommendatio
158155

159156
### Initial {#updateMode-Initial}
160157

161-
In _Initial_ mode, VPA only sets resource requests when Pods are first created. It does not update resources for already running Pods, even if recommendations change over time.
158+
In _Initial_ mode, VPA only sets resource requests when Pods are first created. It does not update resources for already running Pods, even if recommendations change over time. The recommendations apply only during Pod creation.
162159

163160
### Recreate {#updateMode-Recreate}
164161

@@ -172,6 +169,8 @@ controller applies the updated resource requests to the new Pod.
172169
In `InPlaceOrRecreate` mode, VPA attempts to update Pod resource requests and limits without restarting the Pod when possible. However, if in-place updates cannot be performed for a particular resource change, VPA falls back to evicting the Pod
173170
(similar to `Recreate` mode) and allowing the workload controller to create a replacement Pod with updated resources.
174171

172+
In this mode, the updater applies recommendations in-place using the [Resize Container Resources In-Place](/docs/tasks/configure-pod-container/resize-container-resources/) feature.
173+
175174
### Auto (deprecated) {#updateMode-Auto}
176175

177176
{{< note >}}
@@ -231,13 +230,19 @@ Valid resource names include `cpu` and `memory`.
231230
The `controlledValues` field determines whether VPA controls resource requests, limits, or both:
232231

233232
RequestsAndLimits
234-
: VPA sets both requests and limits. The limit is scaled proportionally to the request. This is the default mode.
233+
: VPA sets both requests and limits. The limit scales proportionally to the request based on the request-to-limit ratio defined in the Pod spec. This is the default mode.
235234

236235
RequestsOnly
237236
: VPA only sets requests, leaving limits unchanged. Limits are respected and can still trigger throttling or out-of-memory kills if usage exceeds them.
238237

239238
See [requests and limits](/docs/concepts/configuration/manage-resources-containers/#requests-and-limits) to learn more about those two concepts.
240239

240+
## LimitRange resources
241+
242+
The admission controller and updater VPA components post-process recommendations to comply with the constraints defined in [LimitRanges](/docs/concepts/policy/limit-range/). The LimitRange resources with `type` Pod and Container are checked in the Kubernetes cluster.
243+
244+
For example, if the `max` field in a Container LimitRange resource is exceeded, both VPA components lower the limit to the value defined in the `max` field, and the request is proportionally decreased to maintain the request-to-limit ratio in the Pod spec.
245+
241246
## {{% heading "whatsnext" %}}
242247

243248
If you configure autoscaling in your cluster, you may also want to consider using

0 commit comments

Comments
 (0)