You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,10 +38,6 @@ the pod startup and to scale the CPU resources back down when the pod is
38
38
`Ready` or after certain time has elapsed, leveraging the
39
39
[in-place pod resize Kubernetes feature](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources).
40
40
41
-
> [!NOTE]
42
-
> This feature depends on the new `InPlaceOrRecreate` VPA mode:
43
-
> [AEP-4016: Support for in place updates in VPA](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/enhancements/4016-in-place-updates-support/README.md)
44
-
45
41
### Goals
46
42
47
43
* Allow VPA to boost the CPU request and limit of a pod's containers during the
@@ -61,17 +57,14 @@ time.
61
57
62
58
## Proposal
63
59
64
-
* To extend [`ContainerResourcePolicy`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L191)
60
+
* To extend [`VerticalPodAutoscalerSpec`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L75)
65
61
with a new `StartupBoost` field to allow users to configure the CPU startup
66
62
boost.
67
63
68
-
* To extend [`ContainerScalingMode`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L231-L236)
69
-
with a new `StartupBoostOnly` mode to allow users to only enable the startup
70
-
boost feature and not vanilla VPA altogether.
64
+
* To extend [`ContainerResourcePolicy`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L191)
65
+
with a new `StartupBoost` field to allow users to optionally customize the startup boost behavior for individual containers.
71
66
72
-
* To allow CPU startup boost if a `StartupBoost` config is specified in `Auto`
* To enable only startup boost (if the `StartupBoost` config is present in the VPA object) and not regular VPA altogether.
75
68
76
69
## Design Details
77
70
@@ -95,8 +88,15 @@ down the CPU resources to the appropriate non-boosted value:
95
88
96
89
### API Changes
97
90
98
-
The new `StartupBoost` parameter will be added to the [`ContainerResourcePolicy`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L191)
99
-
and contain the following fields:
91
+
The new `StartupBoost` parameter will be added to both:
Will allow users to optionally customize the startup boost behavior for individual containers.
96
+
97
+
`StartupBoost` will contain the following fields:
98
+
*[Optional]`StartupBoost.CPU.Mode`: whether CPU boost is enabled (`"Auto"`)
99
+
or not (`"Off"`). If not specified, it defaults to `"Auto"`.
100
100
*`StartupBoost.CPU.Factor`: the factor by which to multiply the initial
101
101
resource request and limit of the containers' targeted by the VPA object.
102
102
*`StartupBoost.CPU.Value`: the target value of the CPU request or limit
@@ -121,22 +121,15 @@ and contain the following fields:
121
121
> section for more details on this feature's behavior for different combinations
122
122
> of probers + `StartupBoost.CPU.Duration`.
123
123
124
-
We will also add a new mode to the [`ContainerScalingMode`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L231-L236):
125
-
***NEW**: `StartupBoostOnly`: new mode that will allow users to only enable
126
-
the startup boost feature for a container and not vanilla VPA altogether.
127
-
***NEW**: `Auto`: we will modify the existing `Auto` mode to enable both
128
-
vanilla VPA and CPU Startup Boost (when `StartupBoost` parameter is
129
-
specified).
130
-
131
124
#### Priority of `StartupBoost`
132
125
133
-
The new `StartupBoost` field will take precedence over the rest of the container
134
-
resource policy configurations. Functioning independently from all other fields
The new `StartupBoost` field will take precedence over the rest of the fields
127
+
in [`VerticalPodAutoscalerSpec`](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler-1.3.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L75)
@@ -149,12 +142,11 @@ excluded from [`ControlledResources`](https://github.com/kubernetes/autoscaler/b
149
142
150
143
* We will check that the `startupBoost` configuration is valid when VPA objects
151
144
are created/updated:
152
-
* The VPA autoscaling mode must be `InPlaceOrRecreate` (since it does not
153
-
make sense to use this feature with disruptive modes of VPA).
154
145
* The boost factor is >= 1 (via CRD validation rules)
155
146
* Only one of `StartupBoost.CPU.Factor` or `StartupBoost.CPU.Value` is
156
147
specified
157
-
* The [feature enablement](#feature-enablement) flags must be on.
148
+
* The [feature enablement](#feature-enablement-and-rollback) flags must be
149
+
on.
158
150
159
151
160
152
#### Dynamic Validation
@@ -166,7 +158,7 @@ are created/updated:
166
158
167
159
The VPA Updater **will not** evict a pod if it attempted to scaled the pod down
168
160
in place (to unboost its CPU resources) and the update failed (see the
169
-
[scenarios](https://github.com/kubernetes/autoscaler/blob/0a34bf5d3a71b486bdaa440f1af7f8d50dc8e391/vertical-pod-autoscaler/enhancements/4016-in-place-updates-support/README.md?plain=1#L164-L169) where the VPA
161
+
[scenarios](https://github.com/kubernetes/autoscaler/blob/0a34bf5d3a71b486bdaa440f1af7f8d50dc8e391/vertical-pod-autoscaler/enhancements/4016-in-place-updates-support/README.md?plain=1#L164-L169) where the VPA
170
162
updater will consider that the update failed). This is to avoid an eviction
171
163
loop:
172
164
@@ -179,37 +171,33 @@ the pod in-place and it fails.
179
171
180
172
#### How can this feature be enabled / disabled in a live cluster?
181
173
182
-
* Feature gates names: `CPUStartupBoost` and `InPlaceOrRecreate` (from
Enabling of feature gates `CPUStartupBoost` AND `InPlaceOrRecreate` will cause
189
-
the following to happen:
179
+
Enabling of feature gates `CPUStartupBoost` will cause the following to happen:
190
180
* admission-controller to **accept** new VPA objects being created with
191
-
`StartupBoostOnly` configured.
181
+
`StartupBoost` configured.
192
182
* admission-controller to **boost** CPU resources.
193
183
* updater to **unboost** the CPU resources.
194
184
195
-
Disabling of feature gates `CPUStartupBoost` OR `InPlaceOrRecreate` will cause
196
-
the following to happen:
185
+
Disabling of feature gates `CPUStartupBoost` will cause the following to happen:
197
186
* admission-controller to **reject** new VPA objects being created with
198
-
`StartupBoostOnly` configured.
187
+
`StartupBoost` configured.
199
188
* A descriptive error message should be returned to the user letting them
200
189
know that they are using a feature gated feature.
201
190
* admission-controller **to not** boost CPU resources, should it encounter a
202
-
VPA configured with a `StartupBoost` config and `StartupBoostOnly` or `Auto`
203
-
`ContainerScalingMode`.
191
+
VPA configured with a `StartupBoost` config.
204
192
* updater **to not** unboost CPU resources when pods meet the scale down
205
193
requirements, should it encounter a VPA configured with a `StartupBoost`
206
-
config and `StartupBoostOnly` or `Auto``ContainerScalingMode`.
194
+
config.
207
195
208
196
### Kubernetes Version Compatibility
209
197
210
198
Similarly to [AEP-4016](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/enhancements/4016-in-place-updates-support#kubernetes-version-compatibility),
211
-
`StartupBoost` configuration and `StartupBoostOnly` mode are built assuming that
212
-
VPA will be running on a Kubernetes 1.33+ with the beta version of
199
+
`StartupBoost` configuration is built assuming that VPA will be running on a
200
+
Kubernetes 1.33+ with the beta version of
213
201
[KEP-1287: In-Place Update of Pod Resources](https://github.com/kubernetes/enhancements/issues/1287)
214
202
enabled. If this is not the case, VPA's attempt to unboost pods may fail and the
215
203
pods may remain boosted for their whole lifecycle.
@@ -242,11 +230,47 @@ down.
242
230
Here are some examples of the VPA CR incorporating CPU boosting for different
243
231
scenarios.
244
232
245
-
### CPU Boost Only
233
+
### Per-pod configurations (`startupBoost` configured in `VerticalPodAutoscalerSpec`)
246
234
247
-
All containers under `example` deployment will receive "regular" VPA updates,
248
-
**except for**`boosted-container-name`. `boosted-container-name` will only be
249
-
CPU boosted/unboosted, because it has a `StartupBoostOnly` container policy.
235
+
#### Startup CPU Boost Enabled & VPA Disabled
236
+
237
+
```yaml
238
+
apiVersion: "autoscaling.k8s.io/v1"
239
+
kind: VerticalPodAutoscaler
240
+
metadata:
241
+
name: example-vpa
242
+
spec:
243
+
targetRef:
244
+
apiVersion: "apps/v1"
245
+
kind: Deployment
246
+
name: example
247
+
updatePolicy:
248
+
# This only disables VPA actuations. It doesn't disable
249
+
# startup boost configurations.
250
+
updateMode: "Off"
251
+
startupBoost:
252
+
cpu:
253
+
value: 3.0
254
+
duration: 10s
255
+
```
256
+
257
+
#### Startup CPU Boost Disabled & VPA Enabled
258
+
259
+
```yaml
260
+
apiVersion: "autoscaling.k8s.io/v1"
261
+
kind: VerticalPodAutoscaler
262
+
metadata:
263
+
name: example-vpa
264
+
spec:
265
+
targetRef:
266
+
apiVersion: "apps/v1"
267
+
kind: Deployment
268
+
name: example
269
+
updatePolicy:
270
+
updateMode: "Auto"
271
+
```
272
+
273
+
#### Startup CPU Boost Enabled & VPA Enabled
250
274
251
275
```yaml
252
276
apiVersion: "autoscaling.k8s.io/v1"
@@ -259,23 +283,77 @@ spec:
259
283
kind: Deployment
260
284
name: example
261
285
updatePolicy:
262
-
# VPA Update mode must be InPlaceOrRecreate
263
-
updateMode: "InPlaceOrRecreate"
286
+
updateMode: "Auto"
287
+
startupBoost:
288
+
cpu:
289
+
value: 3.0
290
+
duration: 10s
291
+
```
292
+
293
+
### Per-container configurations (`startupBoost` configured in `ContainerPolicies`)
294
+
295
+
#### Startup CPU Boost Enabled & VPA Disabled
296
+
297
+
All containers under `example` deployment will receive "regular" VPA updates
298
+
(VPA is in `"Auto"` mode in this example), **except for**
299
+
`boosted-container-name`. `boosted-container-name` will only be CPU
300
+
boosted/unboosted (`StartupBoost` is enabled and VPA `Mode` is set to `Off`).
301
+
302
+
```yaml
303
+
apiVersion: "autoscaling.k8s.io/v1"
304
+
kind: VerticalPodAutoscaler
305
+
metadata:
306
+
name: example-vpa
307
+
spec:
308
+
targetRef:
309
+
apiVersion: "apps/v1"
310
+
kind: Deployment
311
+
name: example
264
312
resourcePolicy:
265
313
containerPolicies:
266
314
- containerName: "boosted-container-name"
267
-
mode: "StartupBoostOnly"
315
+
# VPA mode is set to Off, so it never changes pod resources for this
316
+
# container. This setting is independent from the startup boost mode.
317
+
# CPU startup boost changes will still be applied (mode Auto).
318
+
mode: "Off"
268
319
startupBoost:
320
+
mode: "Auto"
269
321
cpu:
270
322
factor: 2.0
271
323
```
272
324
273
-
### CPU Boost and Vanilla VPA
325
+
#### Startup CPU Boost Disabled & VPA Enabled
326
+
327
+
All containers under `example` deployment will receive "regular" VPA updates
328
+
and be CPU boosted/unboosted, except for `disable-cpu-boost-for-this-container`.
329
+
It has a `containerPolicy` `startupBoost` overriding the global VPA config.
0 commit comments