Skip to content

Commit 63ed537

Browse files
committed
Add docs for in-place updates
Signed-off-by: Omer Aplatony <[email protected]>
1 parent db597b1 commit 63ed537

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

vertical-pod-autoscaler/docs/features.md

Lines changed: 74 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)
79

810
## Limits control
911

@@ -50,4 +52,75 @@ 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
58+
59+
VPA supports in-place updates to reduce disruption when applying resource recommendations. This feature leverages Kubernetes' in-place update capabilities (beta in 1.33) to modify container resources without requiring pod recreation.
60+
61+
### Usage
62+
63+
To use in-place updates, set the VPA's `updateMode` to `InPlaceOrRecreate`:
64+
```yaml
65+
apiVersion: autoscaling.k8s.io/v1
66+
kind: VerticalPodAutoscaler
67+
metadata:
68+
name: my-vpa
69+
spec:
70+
updatePolicy:
71+
updateMode: "InPlaceOrRecreate"
72+
```
73+
74+
### Behavior
75+
76+
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.
77+
Updates are attempted when:
78+
* Container requests are outside the recommended bounds
79+
* Quick OOM occurs
80+
* For long-running pods (>12h), when recommendations differ significantly (>10%)
81+
82+
Important Notes
83+
84+
* 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.
85+
86+
* 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.
87+
88+
### Requirements:
89+
90+
* Kubernetes 1.33+ with in-place update feature enabled
91+
* VPA version 1.4.0+ with `InPlaceOrRecreate` feature gate enabled
92+
* Cluster feature gate InPlacePodVerticalScaling enabled
93+
94+
### Configuration
95+
96+
Enable the feature by setting the following flags in VPA components ( for both updater and admission-controller ):
97+
98+
```bash
99+
--feature-gates=InPlaceOrRecreate=true
100+
```
101+
102+
### Limitations
103+
104+
* All containers in a pod are updated together (partial updates not supported)
105+
* Memory downscaling requires careful consideration to prevent OOMs
106+
* Updates still respect VPA's standard update conditions and timing restrictions
107+
* In-place updates will fail for pods with Guaranteed QoS class (requires pod recreation)
108+
109+
### Fallback Behavior
110+
111+
VPA will fall back to pod recreation in the following scenarios:
112+
113+
* 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.)
114+
* 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
115+
* Update is in progress for more than 1 hour
116+
* [Pod QoS](https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/) class would change due to the update
117+
* 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)
118+
119+
### Monitoring
120+
121+
VPA provides metrics to track in-place update operations:
122+
123+
* vpa_in_place_updatable_pods_total: Number of pods matching in-place update criteria
124+
* vpa_in_place_updated_pods_total: Number of pods successfully updated in-place
125+
* vpa_vpas_with_in_place_updatable_pods_total: Number of VPAs with pods eligible for in-place updates
126+
* vpa_vpas_with_in_place_updated_pods_total: Number of VPAs with successfully in-place updated pods

0 commit comments

Comments
 (0)