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
Copy file name to clipboardExpand all lines: modules/nodes-pods-vertical-autoscaler-configuring.adoc
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,8 @@
8
8
9
9
You can use the Vertical Pod Autoscaler Operator (VPA) by creating a VPA custom resource (CR). The CR indicates which pods it should analyze and determines the actions the VPA should take with those pods.
10
10
11
+
You can use the VPA to scale built-in resources such as deployments or stateful sets, and custom resources that manage pods. For more information on using the VPA with custom resources, see "Using the Vertical Pod Autoscaler Operator with Custom Resources."
12
+
11
13
.Prerequisites
12
14
13
15
* The workload object that you want to autoscale must exist.
= Example custom resources for the Vertical Pod Autoscaler
8
+
9
+
The Vertical Pod Autoscaler Operator (VPA) can update not only built-in resources such as deployments or stateful sets, but also custom resources that manage pods.
10
+
11
+
In order to use the VPA with a custom resource, when you create the the `CustomResourceDefinition` (CRD) object, you must configure the `labelSelectorPath` field in the `/scale` subresource. The `/scale` subresource creates a `Scale` object. The `labelSelectorPath` field defines the JSON path inside the custom resource that corresponds to `Status.Selector` in the `Scale` object and in the custom resource. The following is an example of a `CustomResourceDefinition` and a `CustomResource` that fulfills these requirements, along with a `VerticalPodAutoscaler` definition that targets the custom resource. The following example shows the `/scale` subresource contract.
12
+
13
+
[NOTE]
14
+
====
15
+
This example does not result in the VPA scaling pods because there is no controller for the custom resource that allows it to own any pods. As such, you must write a controller in a language supported by Kubernetes to manage the reconciliation and state management between the custom resource and your pods. The example illustrates the configuration for the VPA to understand the custom resource as scalable.
16
+
====
17
+
18
+
.Example custom CRD, CR
19
+
[source,yaml]
20
+
----
21
+
apiVersion: apiextensions.k8s.io/v1
22
+
kind: CustomResourceDefinition
23
+
metadata:
24
+
name: scalablepods.testing.openshift.io
25
+
spec:
26
+
group: testing.openshift.io
27
+
versions:
28
+
- name: v1
29
+
served: true
30
+
storage: true
31
+
schema:
32
+
openAPIV3Schema:
33
+
type: object
34
+
properties:
35
+
spec:
36
+
type: object
37
+
properties:
38
+
replicas:
39
+
type: integer
40
+
minimum: 0
41
+
selector:
42
+
type: string
43
+
status:
44
+
type: object
45
+
properties:
46
+
replicas:
47
+
type: integer
48
+
subresources:
49
+
status: {}
50
+
scale:
51
+
specReplicasPath: .spec.replicas
52
+
statusReplicasPath: .status.replicas
53
+
labelSelectorPath: .spec.selector <1>
54
+
scope: Namespaced
55
+
names:
56
+
plural: scalablepods
57
+
singular: scalablepod
58
+
kind: ScalablePod
59
+
shortNames:
60
+
- spod
61
+
----
62
+
<1> Specifies the JSON path that corresponds to `status.selector` field of the custom resource object.
63
+
64
+
.Example custom CR
65
+
[source,yaml]
66
+
----
67
+
apiVersion: testing.openshift.io/v1
68
+
kind: ScalablePod
69
+
metadata:
70
+
name: scalable-cr
71
+
namespace: default
72
+
spec:
73
+
selector: "app=scalable-cr" <1>
74
+
replicas: 1
75
+
----
76
+
<1> Specify the label type to apply to managed pods. This is the field referenced by the `labelSelectorPath` in the custom resource definition object.
@@ -20,7 +20,167 @@ You can perform the following tunings on the VPA components by editing the `Vert
20
20
21
21
* To configure the VPA Operator to monitor only workloads that are being managed by a VPA CR, set the `memory-saver` parameter to `true` for the recommender component.
22
22
23
-
The following example VPA controller CR sets the VPA API QPS and burts rates, configures the component pod resource requests, and sets `memory-saver` to `true` for the recommender:
23
+
For guidelines on the resources and rate limits that you could set for each VPA component, the following tables provide recommended baseline values, depending on the size of your cluster and other factors.
24
+
25
+
[IMPORTANT]
26
+
====
27
+
These recommended values were derived from internal Red{nbsp}Hat testing on clusters that are not necessarily representative of real-world clusters. You should test these values in a non-production cluster before configuring a production cluster.
It is recommended that you set the memory limit on your containers to at least double the recommended requests in the table. However, because CPU is a compressible resource, setting CPU limits for containers can throttle the VPA. As such, it is recommended that you do not set a CPU limit on your containers.
. QPS specifies the queries per second (QPS) limit when making requests to Kubernetes API server. The default for the updater and recommender pods is `5.0`.
130
+
. Burst specifies the burst limit when making requests to Kubernetes API server. The default for the updater and recommender pods is `10.0`.
131
+
132
+
[NOTE]
133
+
====
134
+
If you have more than 4000 VPAs in your cluster, it is recommended that you start performance tuning with the values in the table and slowly increase the values until you achieve the desired recommender and updater latency and performance. You should adjust these values slowly because increased QPS and Burst could affect the cluster health and slow down the Kubernetes API server if too many API requests are being sent to the API server from the VPA components.
135
+
====
136
+
137
+
////
138
+
Hiding these two NOTEs as not supported. These and the the above should be sub-bullets for "If you have more than 4000 VPAs in your cluster, note the following recommendations:".
139
+
** It is recommended that you increase the recommender and updater interval, which is how often the VPA fetches pod metrics. However, with the longer intervals, the Operator takes longer to recommend and restart pods. The example `VerticalPodAutoscalerController` CR that follows includes the parameters to increase the intervals.
140
+
** If you increase the `recommender-interval` value, it is recommended that you also increase the `checkpoints-timeout` value, which configures the timeout for writing VPA checkpoints after the start of the recommender interval. It is recommended that you set the timeout to the same value `recommender-interval` so that the recommender pod has time to write checkpoints before the next interval. The example `VerticalPodAutoscalerController` CR that follows includes the parameters to increase the timeout.
141
+
////
142
+
143
+
////
144
+
Hiding as autoscaling custom resources not supported
145
+
.Admission Rate limits (by custom resource pod creation surge)
146
+
[options="header"]
147
+
|===
148
+
| Component 2+| 1-25 CR pod creation surge ^[1]^ 2+| 26-50 CR pod creation surge 2+| 50+ CR pod creation surge
149
+
150
+
|
151
+
| *QPS Limit*^[2]^
152
+
| *Burst*^[3]^
153
+
| *QPS Limit*
154
+
| *Burst*
155
+
| *QPS Limit*
156
+
| *Burst*
157
+
158
+
s| Admission
159
+
| 25
160
+
| 50
161
+
| 50
162
+
| 100
163
+
| Pod Surge / 2
164
+
| Pod Surge
165
+
166
+
|===
167
+
[.small]
168
+
. _Pod creation surge_ refers to the maximum number of pods that you expect to be created in a single second at any given time.
169
+
. QPS specifies the queries per second (QPS) limit when making requests to Kubernetes API server. The default is `5.0`.
170
+
. Burst specifies the burst limit when making requests to Kubernetes API server. The default is `10.0`.
171
+
172
+
[NOTE]
173
+
====
174
+
The admission pod can get throttled if you are using the VPA on custom resources.
175
+
====
176
+
////
177
+
178
+
The following example VPA controller CR is for a cluster with 1000 to 2000 containers and a pod creation surge of 26 to 50. The CR sets the following values:
179
+
180
+
* The container memory and CPU requests for all three VPA components
181
+
* The container memory limit for all three VPA components
182
+
* The QPS and burst rates for all three VPA components
183
+
* The `memory-saver` parameter to `true` for the VPA recommender component
24
184
25
185
.Example `VerticalPodAutoscalerController` CR
26
186
[source,yaml]
@@ -35,31 +195,37 @@ spec:
35
195
admission: <1>
36
196
container:
37
197
args: <2>
38
-
- '--kube-api-qps=30.0'
39
-
- '--kube-api-burst=40.0'
198
+
- '--kube-api-qps=50.0'
199
+
- '--kube-api-burst=100.0'
40
200
resources:
41
201
requests: <3>
42
202
cpu: 40m
43
-
memory: 40Mi
203
+
memory: 150Mi
204
+
limits:
205
+
memory: 300Mi
44
206
recommender: <4>
45
207
container:
46
208
args:
47
-
- '--kube-api-qps=20.0'
48
-
- '--kube-api-burst=60.0'
209
+
- '--kube-api-qps=60.0'
210
+
- '--kube-api-burst=120.0'
49
211
- '--memory-saver=true' <5>
50
212
resources:
51
213
requests:
52
-
cpu: 60m
53
-
memory: 60Mi
214
+
cpu: 75m
215
+
memory: 275Mi
216
+
limits:
217
+
memory: 550Mi
54
218
updater: <6>
55
219
container:
56
220
args:
57
-
- '--kube-api-qps=20.0'
58
-
- '--kube-api-burst=80.0'
221
+
- '--kube-api-qps=60.0'
222
+
- '--kube-api-burst=120.0'
59
223
resources:
60
224
requests:
61
225
cpu: 80m
62
-
memory: 80Mi
226
+
memory: 350M
227
+
limits:
228
+
memory: 700Mi
63
229
minReplicas: 2
64
230
podMinCPUMillicores: 25
65
231
podMinMemoryMb: 250
@@ -73,11 +239,21 @@ spec:
73
239
* `kube-api-qps`: Specifies the queries per second (QPS) limit when making requests to Kubernetes API server. The default is `5.0`.
74
240
* `kube-api-burst`: Specifies the burst limit when making requests to Kubernetes API server. The default is `10.0`.
75
241
--
76
-
<3> Specifies the CPU and memory requests for the VPA admission controller pod.
242
+
<3> Specifies the resource requests and limits for the VPA admission controller pod.
77
243
<4> Specifies the tuning parameters for the VPA recommender.
78
244
<5> Specifies that the VPA Operator monitors only workloads with a VPA CR. The default is `false`.
79
245
<6> Specifies the tuning parameters for the VPA updater.
80
246
247
+
////
248
+
Hiding these three callouts as not supported
249
+
<5> Specifies how often the VPA should collect the container metrics for the recommender pod. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, and `h`. The default is one minute.
250
+
<6> Specifies the timeout for writing VPA checkpoints after the start of the recommender interval. If you increase the `recommender-interval` value, it is recommended setting this value to the same value. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, and `h`. The default is one minute.
251
+
<9> Specifies how often the VPA should collect the container metrics for the updater pod. Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, and `h`. The default is one minute.
252
+
- '--recommender-interval=2m' <5>
253
+
- '--checkpoints-timeout=' <6>
254
+
- '--updater-interval=30m0s' <9>
255
+
////
256
+
81
257
You can verify that the settings were applied to each VPA component pod.
0 commit comments