|
4 | 4 |
|
5 | 5 | - [Limits control](#limits-control) |
6 | 6 | - [Memory Value Humanization](#memory-value-humanization) |
| 7 | +- [CPU Recommendation Rounding](#cpu-recommendation-rounding) |
| 8 | +- [In-Place Updates](#in-place-updates) |
7 | 9 |
|
8 | 10 | ## Limits control |
9 | 11 |
|
@@ -50,4 +52,77 @@ To enable this feature, set the --round-cpu-millicores flag when running the VPA |
50 | 52 |
|
51 | 53 | ```bash |
52 | 54 | --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: |
| 77 | +
|
| 78 | +VPA will first attempt to apply updates in-place |
| 79 | +If in-place update fails, VPA will fall back to pod recreation |
| 80 | +Updates are attempted when: |
| 81 | +Container requests are outside the recommended bounds |
| 82 | +Quick OOM occurs |
| 83 | +For long-running pods (>12h), when recommendations differ significantly (>10%) |
| 84 | +Important Notes |
| 85 | +
|
| 86 | +* 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. |
| 87 | +
|
| 88 | +* 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. |
| 89 | +
|
| 90 | +### Requirements: |
| 91 | +
|
| 92 | +* Kubernetes 1.33+ with in-place update feature enabled |
| 93 | +* VPA version 1.4.0+ with InPlaceOrRecreate feature gate enabled |
| 94 | +* Cluster feature gate InPlacePodVerticalScaling enabled |
| 95 | +
|
| 96 | +### Configuration |
| 97 | +
|
| 98 | +Enable the feature by setting the following flags in VPA components ( for both updater and admission-controller ): |
| 99 | +
|
| 100 | +```bash |
| 101 | +--feature-gates=InPlaceOrRecreate=true |
| 102 | +``` |
| 103 | + |
| 104 | +### Limitations |
| 105 | + |
| 106 | +* All containers in a pod are updated together (partial updates not supported) |
| 107 | +* Memory downscaling requires careful consideration to prevent OOMs |
| 108 | +* Updates still respect VPA's standard update conditions and timing restrictions |
| 109 | +* In-place updates will fail for pods with Guaranteed QoS class (requires pod recreation) |
| 110 | + |
| 111 | +### Fallback Behavior |
| 112 | + |
| 113 | +VPA will fall back to pod recreation in the following scenarios: |
| 114 | + |
| 115 | +* 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.) |
| 116 | +* 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 |
| 117 | +* Update is in progress for more than 1 hour |
| 118 | +* [Pod QoS](https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/) class would change due to the update |
| 119 | +* 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) |
| 120 | + |
| 121 | +### Monitoring |
| 122 | + |
| 123 | +VPA provides metrics to track in-place update operations: |
| 124 | + |
| 125 | +* vpa_in_place_updatable_pods_total: Number of pods matching in-place update criteria |
| 126 | +* vpa_in_place_updated_pods_total: Number of pods successfully updated in-place |
| 127 | +* vpa_vpas_with_in_place_updatable_pods_total: Number of VPAs with pods eligible for in-place updates |
| 128 | +* vpa_vpas_with_in_place_updated_pods_total: Number of VPAs with successfully in-place updated pods |
0 commit comments