Skip to content

Commit dfd89f4

Browse files
authored
Merge pull request #8087 from omerap12/in-place-update-docs
Add docs for in-place updates
2 parents 9440674 + a047265 commit dfd89f4

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

vertical-pod-autoscaler/docs/features.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- [Limits control](#limits-control)
66
- [Memory Value Humanization](#memory-value-humanization)
7+
- [CPU Recommendation Rounding](#cpu-recommendation-rounding)
8+
- [In-Place Updates](#in-place-updates-inplaceorrecreate)
79

810
## Limits control
911

@@ -50,4 +52,78 @@ To enable this feature, set the --round-cpu-millicores flag when running the VPA
5052

5153
```bash
5254
--round-cpu-millicores=50
53-
```
55+
```
56+
57+
## In-Place Updates (`InPlaceOrRecreate`)
58+
59+
> [!WARNING]
60+
> FEATURE STATE: VPA v1.4.0 [alpha]
61+
62+
VPA supports in-place updates to reduce disruption when applying resource recommendations. This feature leverages Kubernetes' in-place update capabilities (which is in beta as of Kubernetes 1.33) to modify container resources without requiring pod recreation.
63+
For more information, see [AEP-4016: Support for in place updates in VPA](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/4016-in-place-updates-support)
64+
65+
### Usage
66+
67+
To use in-place updates, set the VPA's `updateMode` to `InPlaceOrRecreate`:
68+
```yaml
69+
apiVersion: autoscaling.k8s.io/v1
70+
kind: VerticalPodAutoscaler
71+
metadata:
72+
name: my-vpa
73+
spec:
74+
updatePolicy:
75+
updateMode: "InPlaceOrRecreate"
76+
```
77+
78+
### Behavior
79+
80+
When using `InPlaceOrRecreate` mode, VPA will first attempt to apply updates in-place, if in-place update fails, VPA will fall back to pod recreation.
81+
Updates are attempted when:
82+
* Container requests are outside the recommended bounds
83+
* Quick OOM occurs
84+
* For long-running pods (>12h), when recommendations differ significantly (>10%)
85+
86+
Important Notes
87+
88+
* Disruption Possibility: While in-place updates aim to minimize disruption, they cannot guarantee zero disruption as the container runtime is responsible for the actual resize operation.
89+
90+
* Memory Limit Downscaling: In the beta version, memory limit downscaling is not supported for pods with resizePolicy: PreferNoRestart. In such cases, VPA will fall back to pod recreation.
91+
92+
### Requirements:
93+
94+
* Kubernetes 1.33+ with `InPlacePodVerticalScaling` feature gate enabled
95+
* VPA version 1.4.0+ with `InPlaceOrRecreate` feature gate enabled
96+
97+
### Configuration
98+
99+
Enable the feature by setting the following flags in VPA components ( for both updater and admission-controller ):
100+
101+
```bash
102+
--feature-gates=InPlaceOrRecreate=true
103+
```
104+
105+
### Limitations
106+
107+
* All containers in a pod are updated together (partial updates not supported)
108+
* Memory downscaling requires careful consideration to prevent OOMs
109+
* Updates still respect VPA's standard update conditions and timing restrictions
110+
* In-place updates will fail if they would result in a change to the pod's QoS class
111+
112+
### Fallback Behavior
113+
114+
VPA will fall back to pod recreation in the following scenarios:
115+
116+
* In-place update is [infeasible](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/1287-in-place-update-pod-resources/README.md#resize-status) (node resources, etc.)
117+
* Update is [deferred](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/1287-in-place-update-pod-resources/README.md#resize-status) for more than 5 minutes
118+
* Update is in progress for more than 1 hour
119+
* [Pod QoS](https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/) class would change due to the update
120+
* Memory limit downscaling is required with [PreferNoRestart policy](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/1287-in-place-update-pod-resources/README.md#container-resize-policy)
121+
122+
### Monitoring
123+
124+
VPA provides metrics to track in-place update operations:
125+
126+
* `vpa_in_place_updatable_pods_total`: Number of pods matching in-place update criteria
127+
* `vpa_in_place_updated_pods_total`: Number of pods successfully updated in-place
128+
* `vpa_vpas_with_in_place_updatable_pods_total`: Number of VPAs with pods eligible for in-place updates
129+
* `vpa_vpas_with_in_place_updated_pods_total`: Number of VPAs with successfully in-place updated pods

0 commit comments

Comments
 (0)