Skip to content

Commit 6115a01

Browse files
authored
Merge pull request #112863 from mburke5678/cqa-nodes-9-4
OSDOCS CQA NODES-9: Autoscaling and Miscellaneous IV
2 parents 7ae213a + 208080e commit 6115a01

11 files changed

Lines changed: 209 additions & 139 deletions

modules/nodes-pods-vertical-autoscaler-about.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
[id="nodes-pods-vertical-autoscaler-about_{context}"]
77
= About the Vertical Pod Autoscaler Operator
88

9-
The Vertical Pod Autoscaler Operator (VPA) is implemented as an API resource and a custom resource (CR). The CR determines the actions for the VPA to take with the pods associated with a specific workload object, such as a daemon set, replication controller, and so forth, in a project.
9+
[role="_abstract"]
10+
To help you maintain the optimal CPU and memory usage for your pods, you can use the {product-title} Vertical Pod Autoscaler Operator (VPA).
11+
12+
The VPA is implemented as an API resource and a custom resource (CR). The CR determines the actions for the VPA to take with the pods associated with a specific workload object, such as a daemon set, replication controller, and so forth, in a project.
1013

1114
The VPA consists of three components, each of which has its own pod in the VPA namespace:
1215

modules/nodes-pods-vertical-autoscaler-configuring.adoc

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
[id="nodes-pods-vertical-autoscaler-configuring_{context}"]
77
= Using the Vertical Pod Autoscaler Operator
88

9-
You can use the Vertical Pod Autoscaler Operator (VPA) by creating a VPA custom resource (CR). The CR indicates the pods to analyze and determines the actions for the VPA to take with those pods.
9+
[role="_abstract"]
10+
You can use the Vertical Pod Autoscaler Operator (VPA) to help you maintain the optimal CPU and memory usage for your pods by creating a VPA custom resource (CR). The CR indicates the pods to analyze and determines the actions for the VPA to take with those pods.
1011

1112
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, see "About using the Vertical Pod Autoscaler Operator".
1213

14+
The following procedure creates a VPA CR for a specific workload object.
15+
1316
.Prerequisites
1417

1518
* Ensure the workload object that you want to autoscale exists.
@@ -18,8 +21,6 @@ You can use the VPA to scale built-in resources such as deployments or stateful
1821
1922
.Procedure
2023

21-
To create a VPA CR for a specific workload object:
22-
2324
. Change to the location of the project for the workload object you want to scale.
2425

2526
.. Create a VPA CR YAML file:
@@ -33,26 +34,28 @@ metadata:
3334
spec:
3435
targetRef:
3536
apiVersion: "apps/v1"
36-
kind: Deployment <1>
37-
name: frontend <2>
37+
kind: Deployment
38+
name: frontend
3839
updatePolicy:
39-
updateMode: "InPlaceOrRecreate" <3>
40-
resourcePolicy: <4>
40+
updateMode: "InPlaceOrRecreate"
41+
resourcePolicy:
4142
containerPolicies:
4243
- containerName: my-opt-sidecar
4344
mode: "Off"
44-
recommenders: <5>
45+
recommenders:
4546
- name: my-recommender
4647
----
47-
<1> Specify the type of workload object you want this VPA to manage: `Deployment`, `StatefulSet`, `Job`, `DaemonSet`, `ReplicaSet`, or `ReplicationController`.
48-
<2> Specify the name of an existing workload object you want this VPA to manage.
49-
<3> Specify the VPA mode:
48+
where:
49+
50+
`spec.targetRef.kind`:: Specifies the type of workload object you want this VPA to manage: `Deployment`, `StatefulSet`, `Job`, `DaemonSet`, `ReplicaSet`, or `ReplicationController`.
51+
`spec.targetRef.name`:: Specifies the name of an existing workload object you want this VPA to manage.
52+
`spec.updatePolicy.updateMode`:: Specifies the VPA mode:
5053
* `InPlaceOrRecreate` to automatically apply the recommended resources on pods associated with the workload object. The VPA attempts to update the workload object with the new resources without re-creating the pod. If the VPA is unable to update the object in place, the VPA re-creates it.
5154
* `Recreate` to automatically apply the recommended resources on pods associated with the workload object. The VPA terminates existing pods and creates new pods with the recommended resource limits and requests. Use the `Recreate` mode only if you need to ensure that the pods restart whenever the resource request changes.
5255
* `Initial` to automatically apply the recommended resources to newly-created pods associated with the workload object. The VPA does not update the pods as it learns new resource recommendations.
5356
* `Off` to only generate resource recommendations for the pods associated with the workload object. The VPA does not update the pods as it learns new resource recommendations and does not apply the recommendations to new pods.
54-
<4> Optional. Specify the containers you want to opt-out and set the mode to `Off`.
55-
<5> Optional. Specify an alternative recommender.
57+
`spec.resourcePolicy`:: Specifies the containers you want to opt-out and set the mode to `Off`. This parameter is optional.
58+
`spec.recommenders`:: Specifies an alternative recommender. This parameter is optional.
5659

5760
.. Create the VPA CR:
5861
+
@@ -85,16 +88,16 @@ status:
8588
recommendation:
8689
containerRecommendations:
8790
- containerName: frontend
88-
lowerBound: <1>
91+
lowerBound:
8992
cpu: 25m
9093
memory: 262144k
91-
target: <2>
94+
target:
9295
cpu: 25m
9396
memory: 262144k
94-
uncappedTarget: <3>
97+
uncappedTarget:
9598
cpu: 25m
9699
memory: 262144k
97-
upperBound: <4>
100+
upperBound:
98101
cpu: 262m
99102
memory: "274357142"
100103
- containerName: backend
@@ -113,7 +116,11 @@ status:
113116

114117
...
115118
----
116-
<1> `lowerBound` is the minimum recommended resource levels.
117-
<2> `target` is the recommended resource levels.
118-
<3> `upperBound` is the highest recommended resource levels.
119-
<4> `uncappedTarget` is the most recent resource recommendations.
119+
where:
120+
121+
`status.recommendation.containerRecommendations`:: Specifies the minimum and maximum recommended resource levels for the container:
122+
* `containerName` is the container for the recommended resource levels.
123+
* `lowerBound` is the minimum recommended resource levels.
124+
* `target` is the recommended resource levels.
125+
* `upperBound` is the highest recommended resource levels.
126+
* `uncappedTarget` is the most recent resource recommendations.

modules/nodes-pods-vertical-autoscaler-custom-resource.adoc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-vertical-autoscaler-custom-resource_{context}"]
77
= Example custom resources for the Vertical Pod Autoscaler
88

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.
9+
[role="_abstract"]
10+
You can use the Vertical Pod Autoscaler Operator (VPA) to update custom resources that manage pods, not just built-in resources such as deployments or stateful sets.
1011

1112
To use the VPA with a custom resource when you create 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.
1213

@@ -50,7 +51,7 @@ spec:
5051
scale:
5152
specReplicasPath: .spec.replicas
5253
statusReplicasPath: .status.replicas
53-
labelSelectorPath: .spec.selector <1>
54+
labelSelectorPath: .spec.selector
5455
scope: Namespaced
5556
names:
5657
plural: scalablepods
@@ -59,7 +60,9 @@ spec:
5960
shortNames:
6061
- spod
6162
----
62-
<1> Specifies the JSON path that corresponds to `status.selector` field of the custom resource object.
63+
where:
64+
65+
`spec.subresources.scale.labelSelectorPath`:: Specifies the JSON path that corresponds to `status.selector` field of the custom resource object.
6366

6467
.Example custom CR
6568
[source,yaml]
@@ -70,10 +73,12 @@ metadata:
7073
name: scalable-cr
7174
namespace: default
7275
spec:
73-
selector: "app=scalable-cr" <1>
76+
selector: "app=scalable-cr"
7477
replicas: 1
7578
----
76-
<1> Specify the label type to apply to managed pods. This is the field that the `labelSelectorPath` references in the custom resource definition object.
79+
where:
80+
81+
`spec.selector`:: Specifies the label type to apply to managed pods. This is the field that the `labelSelectorPath` references in the custom resource definition object.
7782

7883
.Example VPA object
7984
[source,yaml]

modules/nodes-pods-vertical-autoscaler-custom.adoc

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
[id="nodes-pods-vertical-autoscaler-custom_{context}"]
77
= Using an alternative recommender
88

9-
You can use your own recommender to autoscale based on your own algorithms. If you do not specify an alternative recommender, {product-title} uses the default recommender, which suggests CPU and memory requests based on historical usage. Because there is no universal recommendation policy that applies to all types of workloads, you might want to create and deploy different recommenders for specific workloads.
9+
[role="_abstract"]
10+
You can use your own recommender to autoscale based on your own algorithms. If you do not specify an alternative recommender, {product-title} uses the default recommender, which suggests CPU and memory requests based on historical usage.
11+
12+
Because there is no universal recommendation policy that applies to all types of workloads, you might want to create and deploy different recommenders for specific workloads.
1013

1114
For example, the default recommender might not accurately predict future resource usage when containers exhibit certain resource behaviors. Examples are cyclical patterns that alternate between usage spikes and idling as used by monitoring applications, or recurring and repeating patterns used with deep learning applications. Using the default recommender with these usage behaviors might result in significant over-provisioning and Out of Memory (OOM) kills for your applications.
1215

@@ -17,21 +20,21 @@ For example, the default recommender might not accurately predict future resourc
1720
Instructions for how to create a recommender are beyond the scope of this documentation.
1821
====
1922

20-
.Procedure
23+
The following procedure shows how to use an alternative recommender for your pods.
2124

22-
To use an alternative recommender for your pods:
25+
.Procedure
2326

2427
. Create a service account for the alternative recommender and bind that service account to the required cluster role:
2528
+
2629
[source,yaml]
2730
----
28-
apiVersion: v1 <1>
31+
apiVersion: v1
2932
kind: ServiceAccount
3033
metadata:
3134
name: alt-vpa-recommender-sa
3235
namespace: <namespace_name>
3336
---
34-
apiVersion: rbac.authorization.k8s.io/v1 <2>
37+
apiVersion: rbac.authorization.k8s.io/v1
3538
kind: ClusterRoleBinding
3639
metadata:
3740
name: system:example-metrics-reader
@@ -44,7 +47,7 @@ subjects:
4447
name: alt-vpa-recommender-sa
4548
namespace: <namespace_name>
4649
---
47-
apiVersion: rbac.authorization.k8s.io/v1 <3>
50+
apiVersion: rbac.authorization.k8s.io/v1
4851
kind: ClusterRoleBinding
4952
metadata:
5053
name: system:example-vpa-actor
@@ -57,7 +60,7 @@ subjects:
5760
name: alt-vpa-recommender-sa
5861
namespace: <namespace_name>
5962
---
60-
apiVersion: rbac.authorization.k8s.io/v1 <4>
63+
apiVersion: rbac.authorization.k8s.io/v1
6164
kind: ClusterRoleBinding
6265
metadata:
6366
name: system:example-vpa-target-reader-binding
@@ -70,10 +73,13 @@ subjects:
7073
name: alt-vpa-recommender-sa
7174
namespace: <namespace_name>
7275
----
73-
<1> Creates a service account for the recommender in the namespace that displays the recommender.
74-
<2> Binds the recommender service account to the `metrics-reader` role. Specify the namespace for where to deploy the recommender.
75-
<3> Binds the recommender service account to the `vpa-actor` role. Specify the namespace for where to deploy the recommender.
76-
<4> Binds the recommender service account to the `vpa-target-reader` role. Specify the namespace for where to display the recommender.
76+
+
77+
--
78+
* The `alt-vpa-recommender-sa` object creates a service account for the recommender in the namespace that displays the recommender.
79+
* The `system:metrics-reader` object binds the recommender service account to the `metrics-reader` role. Specify the namespace for where to deploy the recommender.
80+
* The `system:example-vpa-actor` object binds the recommender service account to the `vpa-actor` role. Specify the namespace for where to deploy the recommender.
81+
* The `system:example-vpa-target-reader-binding` object binds the recommender service account to the `vpa-target-reader` role. Specify the namespace for where to display the recommender.
82+
--
7783

7884
. To add the alternative recommender to the cluster, create a `Deployment` object similar to the following:
7985
+
@@ -94,9 +100,9 @@ spec:
94100
labels:
95101
app: alt-vpa-recommender
96102
spec:
97-
containers: <1>
103+
containers:
98104
- name: recommender
99-
image: quay.io/example/alt-recommender:latest <2>
105+
image: quay.io/example/alt-recommender:latest
100106
imagePullPolicy: Always
101107
resources:
102108
limits:
@@ -115,15 +121,16 @@ spec:
115121
- ALL
116122
seccompProfile:
117123
type: RuntimeDefault
118-
serviceAccountName: alt-vpa-recommender-sa <3>
124+
serviceAccountName: alt-vpa-recommender-sa
119125
securityContext:
120126
runAsNonRoot: true
121127
----
128+
where:
122129
+
123130
--
124-
<1> Creates a container for your alternative recommender.
125-
<2> Specifies your recommender image.
126-
<3> Associates the service account that you created for the recommender.
131+
`spec.template.spec.containers`:: Specifies a container for your alternative recommender.
132+
`spec.template.spec.containers.image`:: Specifies your recommender image.
133+
`spec.template.spec.serviceAccountName`:: Specifies the service account that you created for the recommender.
127134
--
128135
+
129136
A new pod is created for the alternative recommender in the same namespace.
@@ -155,11 +162,13 @@ metadata:
155162
namespace: <namespace_name>
156163
spec:
157164
recommenders:
158-
- name: alt-vpa-recommender <1>
165+
- name: alt-vpa-recommender
159166
targetRef:
160167
apiVersion: "apps/v1"
161-
kind: Deployment <2>
168+
kind: Deployment
162169
name: frontend
163170
----
164-
<1> Specifies the name of the alternative recommender deployment.
165-
<2> Specifies the name of an existing workload object you want this VPA to manage.
171+
where:
172+
173+
`spec.recommenders.name`:: Specifies the name of the alternative recommender deployment.
174+
`spec.targetRef.kind`:: Specifies the name of an existing workload object you want this VPA to manage.

modules/nodes-pods-vertical-autoscaler-install.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-vertical-autoscaler-install_{context}"]
77
= Installing the Vertical Pod Autoscaler Operator
88

9-
You can use the {product-title} web console to install the Vertical Pod Autoscaler Operator (VPA).
9+
[role="_abstract"]
10+
You can install the Vertical Pod Autoscaler Operator (VPA) by using the {product-title} web console.
1011

1112
ifdef::openshift-origin[]
1213
.Prerequisites

0 commit comments

Comments
 (0)