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
Long application start time is a known problem for more traditional workloads
30
35
running in containerized applications, especially Java workloads. This delay can
@@ -38,10 +43,6 @@ the pod startup and to scale the CPU resources back down when the pod is
38
43
`Ready` or after certain time has elapsed, leveraging the
39
44
[in-place pod resize Kubernetes feature](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/1287-in-place-update-pod-resources).
40
45
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
46
### Goals
46
47
47
48
* Allow VPA to boost the CPU request and limit of a pod's containers during the
@@ -61,17 +62,16 @@ time.
61
62
62
63
## Proposal
63
64
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
+
* 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
66
with a new `StartupBoost` field to allow users to configure the CPU startup
66
67
boost.
67
68
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.
69
+
* 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)
70
+
with a new `StartupBoost` field to allow users to optionally customize the
71
+
startup boost behavior for individual containers.
71
72
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
74
+
VPA object) without having to ALSO use the traditional VPA functionality.
75
75
76
76
## Design Details
77
77
@@ -95,24 +95,37 @@ down the CPU resources to the appropriate non-boosted value:
95
95
96
96
### API Changes
97
97
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:
100
-
*`StartupBoost.CPU.Factor`: the factor by which to multiply the initial
101
-
resource request and limit of the containers' targeted by the VPA object.
102
-
*`StartupBoost.CPU.Value`: the target value of the CPU request or limit
103
-
during the startup boost phase.
98
+
The new `StartupBoost` parameter will be added to both:
> Only one of `Factor` or `Value` may be specified per container policy.
114
-
115
-
116
129
> [!NOTE]
117
130
> To ensure that containers are unboosted only after their applications are
118
131
> started and ready, it is recommended to configure a
@@ -121,22 +134,15 @@ and contain the following fields:
121
134
> section for more details on this feature's behavior for different combinations
122
135
> of probers + `StartupBoost.CPU.Duration`.
123
136
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
137
#### Priority of `StartupBoost`
132
138
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
140
+
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,24 +155,21 @@ excluded from [`ControlledResources`](https://github.com/kubernetes/autoscaler/b
149
155
150
156
* We will check that the `startupBoost` configuration is valid when VPA objects
151
157
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
-
* The boost factor is >= 1 (via CRD validation rules)
155
-
* Only one of `StartupBoost.CPU.Factor` or `StartupBoost.CPU.Value` is
156
-
specified
157
-
* The [feature enablement](#feature-enablement) flags must be on.
158
+
* The boost factor value is >= 1 (via CRD validation rules)
159
+
* The [feature enablement](#feature-enablement-and-rollback) flags must be
160
+
on.
158
161
159
162
160
163
#### Dynamic Validation
161
164
162
-
*`StartupBoost.CPU.Value` must be greater than the CPU request or limit of the
165
+
*The boosted CPU value must be greater than the CPU request or limit of the
163
166
container during the boost phase, otherwise we risk downscaling the container.
164
167
165
168
### Mitigating Failed In-Place Downsizes
166
169
167
170
The VPA Updater **will not** evict a pod if it attempted to scaled the pod down
168
171
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
172
+
[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
173
updater will consider that the update failed). This is to avoid an eviction
171
174
loop:
172
175
@@ -179,37 +182,33 @@ the pod in-place and it fails.
179
182
180
183
#### How can this feature be enabled / disabled in a live cluster?
181
184
182
-
* Feature gates names: `CPUStartupBoost` and `InPlaceOrRecreate` (from
Enabling of feature gates `CPUStartupBoost` AND `InPlaceOrRecreate` will cause
189
-
the following to happen:
190
+
Enabling of feature gates `CPUStartupBoost` will cause the following to happen:
190
191
* admission-controller to **accept** new VPA objects being created with
191
-
`StartupBoostOnly` configured.
192
+
`StartupBoost` configured.
192
193
* admission-controller to **boost** CPU resources.
193
194
* updater to **unboost** the CPU resources.
194
195
195
-
Disabling of feature gates `CPUStartupBoost` OR `InPlaceOrRecreate` will cause
196
-
the following to happen:
196
+
Disabling of feature gates `CPUStartupBoost` will cause the following to happen:
197
197
* admission-controller to **reject** new VPA objects being created with
198
-
`StartupBoostOnly` configured.
198
+
`StartupBoost` configured.
199
199
* A descriptive error message should be returned to the user letting them
200
200
know that they are using a feature gated feature.
201
201
* admission-controller **to not** boost CPU resources, should it encounter a
202
-
VPA configured with a `StartupBoost` config and `StartupBoostOnly` or `Auto`
203
-
`ContainerScalingMode`.
202
+
VPA configured with a `StartupBoost` config.
204
203
* updater **to not** unboost CPU resources when pods meet the scale down
205
204
requirements, should it encounter a VPA configured with a `StartupBoost`
206
-
config and `StartupBoostOnly` or `Auto``ContainerScalingMode`.
205
+
config.
207
206
208
207
### Kubernetes Version Compatibility
209
208
210
209
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
210
+
`StartupBoost` configuration is built assuming that VPA will be running on a
211
+
Kubernetes 1.33+ with the beta version of
213
212
[KEP-1287: In-Place Update of Pod Resources](https://github.com/kubernetes/enhancements/issues/1287)
214
213
enabled. If this is not the case, VPA's attempt to unboost pods may fail and the
215
214
pods may remain boosted for their whole lifecycle.
@@ -242,11 +241,31 @@ down.
242
241
Here are some examples of the VPA CR incorporating CPU boosting for different
243
242
scenarios.
244
243
245
-
### CPU Boost Only
244
+
### Per-pod configurations (`startupBoost` configured in `VerticalPodAutoscalerSpec`)
246
245
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.
246
+
#### Startup CPU Boost Enabled & VPA Disabled
247
+
248
+
```yaml
249
+
apiVersion: "autoscaling.k8s.io/v1"
250
+
kind: VerticalPodAutoscaler
251
+
metadata:
252
+
name: example-vpa
253
+
spec:
254
+
targetRef:
255
+
apiVersion: "apps/v1"
256
+
kind: Deployment
257
+
name: example
258
+
updatePolicy:
259
+
# This only disables VPA actuations. It doesn't disable
260
+
# startup boost configurations.
261
+
updateMode: "Off"
262
+
startupBoost:
263
+
cpu:
264
+
value: 3.0
265
+
duration: 10s
266
+
```
267
+
268
+
#### Startup CPU Boost Disabled & VPA Enabled
250
269
251
270
```yaml
252
271
apiVersion: "autoscaling.k8s.io/v1"
@@ -259,23 +278,94 @@ spec:
259
278
kind: Deployment
260
279
name: example
261
280
updatePolicy:
262
-
# VPA Update mode must be InPlaceOrRecreate
263
-
updateMode: "InPlaceOrRecreate"
281
+
updateMode: "Auto"
282
+
```
283
+
284
+
#### Startup CPU Boost Enabled & VPA Enabled
285
+
286
+
```yaml
287
+
apiVersion: "autoscaling.k8s.io/v1"
288
+
kind: VerticalPodAutoscaler
289
+
metadata:
290
+
name: example-vpa
291
+
spec:
292
+
targetRef:
293
+
apiVersion: "apps/v1"
294
+
kind: Deployment
295
+
name: example
296
+
updatePolicy:
297
+
updateMode: "Auto"
298
+
startupBoost:
299
+
cpu:
300
+
value: 3.0
301
+
duration: 10s
302
+
```
303
+
304
+
### Per-container configurations (`startupBoost` configured in `ContainerPolicies`)
305
+
306
+
#### Startup CPU Boost Enabled & VPA Disabled
307
+
308
+
All containers under `example` deployment will receive "regular" VPA updates
309
+
(VPA is in `"Auto"` mode in this example), **except for**
310
+
`boosted-container-name`. `boosted-container-name` will only be CPU
311
+
boosted/unboosted (`StartupBoost` is enabled and VPA `Mode` is set to `Off`).
312
+
313
+
```yaml
314
+
apiVersion: "autoscaling.k8s.io/v1"
315
+
kind: VerticalPodAutoscaler
316
+
metadata:
317
+
name: example-vpa
318
+
spec:
319
+
targetRef:
320
+
apiVersion: "apps/v1"
321
+
kind: Deployment
322
+
name: example
264
323
resourcePolicy:
265
324
containerPolicies:
266
325
- containerName: "boosted-container-name"
267
-
mode: "StartupBoostOnly"
326
+
# VPA mode is set to Off, so it never changes pod resources for this
327
+
# container. This setting is independent from the startup boost mode.
328
+
# CPU startup boost changes will still be applied.
329
+
mode: "Off"
268
330
startupBoost:
269
331
cpu:
270
-
factor: 2.0
332
+
type: "Quantity"
333
+
value: "2"
271
334
```
272
335
273
-
### CPU Boost and Vanilla VPA
336
+
#### Startup CPU Boost Disabled & VPA Enabled
337
+
338
+
All containers under `example` deployment will receive "regular" VPA updates
339
+
and be CPU boosted/unboosted, except for `disable-cpu-boost-for-this-container`.
340
+
It has a `containerPolicy` `startupBoost` overriding the global VPA config that
0 commit comments