Skip to content

Commit 2a7271f

Browse files
author
Michael Burke
committed
OSDOCS CQA NODES-9: Autoscaling and Miscellaneous III
1 parent a13a0c1 commit 2a7271f

16 files changed

Lines changed: 180 additions & 151 deletions

modules/nodes-pods-autoscaling-about.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-about_{context}"]
77
= Understanding horizontal pod autoscalers
88

9-
You can create a horizontal pod autoscaler to specify the minimum and maximum number of pods you want to run, and the CPU usage or memory usage your pods should target.
9+
[role="_abstract"]
10+
You can create a horizontal pod autoscaler to specify the minimum and maximum number of pods you want to run and the CPU usage or memory usage your pods should target.
1011

1112
After you create a horizontal pod autoscaler, {product-title} begins to query the CPU, memory, or both resource metrics on the pods. When these metrics are available, the horizontal pod autoscaler computes the ratio of the current metric use with the intended metric use, and scales up or down as needed. The query and scaling occurs at a regular interval, but can take one to two minutes before metrics become available.
1213

modules/nodes-pods-autoscaling-best-practices-hpa.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-best-practices-hpa_{context}"]
77
= Best practices
88

9-
For optimal performance, configure resource requests for all pods. To prevent frequent replica fluctuations, configure the cooldown period.
9+
[role="_abstract"]
10+
You can help ensure optimal performance in your cluster by configuring resource requests for all pods. Additionally, you can prevent frequent replica fluctuations by configuring the cooldown period.
1011

1112
All pods must have resource requests configured::
1213
The HPA makes a scaling decision based on the observed CPU or memory usage values of pods in an {product-title} cluster. Utilization values are calculated as a percentage of the resource requests of each pod. Missing resource request values can affect the optimal performance of the HPA.

modules/nodes-pods-autoscaling-creating-cpu-percent.adoc

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-creating-cpu-percent_{context}"]
77
= Creating a horizontal pod autoscaler for a percent of CPU use
88

9-
Using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing object based on percent of CPU use. The HPA scales the pods associated with that object to maintain the CPU use that you specify.
9+
[role="_abstract"]
10+
You can use the {product-title} CLI to create a horizontal pod autoscaler (HPA) that automatically scales an existing object based on percent of CPU use. The HPA scales the pods associated with that object to maintain the CPU use that you specify.
1011

1112
When autoscaling for a percent of CPU use, you can use the `oc autoscale` command to specify the minimum and maximum number of pods that you want to run at any given time and the average CPU use your pods should target. If you do not specify a minimum, the pods are given default values from the {product-title} server.
1213

@@ -25,16 +26,19 @@ include::snippets/nodes-pods-autoscaling-creating-cpu-prereqs.adoc[]
2526
+
2627
[source,terminal]
2728
----
28-
$ oc autoscale <object_type>/<name> \// <1>
29-
--min <number> \// <2>
30-
--max <number> \// <3>
31-
--cpu-percent=<percent> <4>
29+
$ oc autoscale <object_type>/<name> \
30+
--min <number> \
31+
--max <number> \
32+
--cpu-percent=<percent>
3233
----
34+
where:
3335
+
34-
<1> Specify the type and name of the object to autoscale. The object must exist and be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
35-
<2> Optional: Specify the minimum number of replicas when scaling down.
36-
<3> Specify the maximum number of replicas when scaling up.
37-
<4> Specify the target average CPU use over all the pods, represented as a percent of requested CPU. If not specified or negative, a default autoscaling policy is used.
36+
--
37+
`<object_type>/<name>`:: Specifies the type and name of the object to autoscale. The object must exist and be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
38+
`min`:: Specifies the minimum number of replicas when scaling down. Replace `<number>` with the minimum number of replicas. This parameter is optional.
39+
`max`:: Specifies the maximum number of replicas when scaling up. Replace `<number>` with the maximum number of replicas.
40+
`cpu-percent`:: Specifies the target average CPU use over all the pods, represented as a percent of requested CPU. Replace `<percent>` with requested percentage. If not specified or negative, a default autoscaling policy is used.
41+
--
3842
+
3943
For example, the following command shows autoscaling for the `hello-node` deployment object. The initial deployment requires 3 pods. The HPA object increases the minimum to 5. If CPU usage on the pods reaches 75%, the pods will increase to 7:
4044
+

modules/nodes-pods-autoscaling-creating-cpu-specific.adoc

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-creating-cpu-specific_{context}"]
77
= Creating a horizontal pod autoscaler for a specific CPU value
88

9-
Using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing object based on a specific CPU value by creating a `HorizontalPodAutoscaler` object with the target CPU and pod limits. The HPA scales the pods associated with that object to maintain the CPU use that you specify.
9+
[role="_abstract"]
10+
You can use the {product-title} CLI to create a horizontal pod autoscaler (HPA) that automatically scales an existing object based on a specific CPU value by creating a `HorizontalPodAutoscaler` object with the target CPU and pod limits. The HPA scales the pods associated with that object to maintain the CPU use that you specify.
1011

1112
[NOTE]
1213
====
@@ -23,40 +24,44 @@ include::snippets/nodes-pods-autoscaling-creating-cpu-prereqs.adoc[]
2324
+
2425
[source,yaml,options="nowrap"]
2526
----
26-
apiVersion: autoscaling/v2 <1>
27+
apiVersion: autoscaling/v2
2728
kind: HorizontalPodAutoscaler
2829
metadata:
29-
name: cpu-autoscale <2>
30+
name: cpu-autoscale
3031
namespace: default
3132
spec:
3233
scaleTargetRef:
33-
apiVersion: apps/v1 <3>
34-
kind: Deployment <4>
35-
name: example <5>
36-
minReplicas: 1 <6>
37-
maxReplicas: 10 <7>
38-
metrics: <8>
34+
apiVersion: apps/v1
35+
kind: Deployment
36+
name: example
37+
minReplicas: 1
38+
maxReplicas: 10
39+
metrics:
3940
- type: Resource
4041
resource:
41-
name: cpu <9>
42+
name: cpu
4243
target:
43-
type: AverageValue <10>
44-
averageValue: 500m <11>
44+
type: AverageValue
45+
averageValue: 500m
4546
----
46-
<1> Use the `autoscaling/v2` API.
47-
<2> Specify a name for this horizontal pod autoscaler object.
48-
<3> Specify the API version of the object to scale:
47+
where:
48+
+
49+
--
50+
`apiVersion`:: Specifies the `autoscaling/v2` API.
51+
`metadata.name`:: Specifies a name for this horizontal pod autoscaler object.
52+
`spec.scaleTargetRef.apiVersion`:: Specifies the API version of the object to scale:
4953
* For a `Deployment`, `ReplicaSet`, `Statefulset` object, use `apps/v1`.
5054
* For a `ReplicationController`, use `v1`.
5155
* For a `DeploymentConfig`, use `apps.openshift.io/v1`.
52-
<4> Specify the type of object. The object must be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
53-
<5> Specify the name of the object to scale. The object must exist.
54-
<6> Specify the minimum number of replicas when scaling down.
55-
<7> Specify the maximum number of replicas when scaling up.
56-
<8> Use the `metrics` parameter for memory use.
57-
<9> Specify `cpu` for CPU usage.
58-
<10> Set to `AverageValue`.
59-
<11> Set to `averageValue` with the targeted CPU value.
56+
`spec.scaleTargetRef.kind`:: Specifies the type of object. The object must be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
57+
`spec.scaleTargetRef.name`:: Specifies the name of the object to scale. The object must exist.
58+
`spec.minReplicas`:: Specifies the minimum number of replicas when scaling down.
59+
`spec.maxReplicas`:: Specifies the maximum number of replicas when scaling up.
60+
`spec.metrics`:: Specifies the parameters to calculate the desired replica count.
61+
`spec.metrics.resource.name`:: Specifies a name for the resource.
62+
`spec.metrics.resource.target.type`:: Specifies the type of target, here `AverageValue` for a specific CPU value.
63+
`spec.metrics.resource.target.averageValue`:: Specifies the targeted CPU value.
64+
--
6065

6166
. Create the horizontal pod autoscaler:
6267
+

modules/nodes-pods-autoscaling-creating-cpu.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
//
33
// * nodes/nodes-pods-autoscaling.adoc
44

5-
:_mod-docs-content-type: PROCEDURE
5+
:_mod-docs-content-type: CONCEPT
66
[id="nodes-pods-autoscaling-creating-cpu_{context}"]
77
= Creating a horizontal pod autoscaler by using the CLI
88

9-
Using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing `Deployment`, `DeploymentConfig`, `ReplicaSet`, `ReplicationController`, or `StatefulSet` object. The HPA scales the pods associated with that object to maintain the CPU or memory resources that you specify.
9+
[role="_abstract"]
10+
By using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing `Deployment`, `DeploymentConfig`, `ReplicaSet`, `ReplicationController`, or `StatefulSet` object. The HPA scales the pods associated with that object to maintain the CPU or memory resources that you specify.
1011

1112
You can autoscale based on CPU or memory use by specifying a percentage of resource usage or a specific value, as described in the following sections.
1213

modules/nodes-pods-autoscaling-creating-memory-percent.adoc

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
= Creating a horizontal pod autoscaler object for a percent of memory use
99

10-
Using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing object based on a percent of memory use. The HPA scales the pods associated with that object to maintain the memory use that you specify.
10+
[role="_abstract"]
11+
You can use the {product-title} CLI to create a horizontal pod autoscaler (HPA) that automatically scales an existing object based on a percent of memory use. The HPA scales the pods associated with that object to maintain the memory use that you specify.
1112

1213
[NOTE]
1314
====
@@ -26,26 +27,26 @@ include::snippets/nodes-pods-autoscaling-creating-cpu-prereqs.adoc[]
2627
+
2728
[source,yaml,options="nowrap"]
2829
----
29-
apiVersion: autoscaling/v2 <1>
30+
apiVersion: autoscaling/v2
3031
kind: HorizontalPodAutoscaler
3132
metadata:
32-
name: memory-autoscale <2>
33+
name: memory-autoscale
3334
namespace: default
3435
spec:
3536
scaleTargetRef:
36-
apiVersion: apps/v1 <3>
37-
kind: Deployment <4>
38-
name: example <5>
39-
minReplicas: 1 <6>
40-
maxReplicas: 10 <7>
41-
metrics: <8>
37+
apiVersion: apps/v1
38+
kind: Deployment
39+
name: example
40+
minReplicas: 1
41+
maxReplicas: 10
42+
metrics:
4243
- type: Resource
4344
resource:
44-
name: memory <9>
45+
name: memory
4546
target:
46-
type: Utilization <10>
47-
averageUtilization: 50 <11>
48-
behavior: <12>
47+
type: Utilization
48+
averageUtilization: 50
49+
behavior:
4950
scaleUp:
5051
stabilizationWindowSeconds: 180
5152
policies:
@@ -57,23 +58,26 @@ spec:
5758
periodSeconds: 120
5859
selectPolicy: Max
5960
----
60-
<1> Use the `autoscaling/v2` API.
61-
<2> Specify a name for this horizontal pod autoscaler object.
62-
<3> Specify the API version of the object to scale:
63-
* For a ReplicationController, use `v1`.
64-
* For a DeploymentConfig, use `apps.openshift.io/v1`.
65-
* For a Deployment, ReplicaSet, Statefulset object, use `apps/v1`.
66-
<4> Specify the type of object. The object must be a `Deployment`, `DeploymentConfig`,
67-
`ReplicaSet`, `ReplicationController`, or `StatefulSet`.
68-
<5> Specify the name of the object to scale. The object must exist.
69-
<6> Specify the minimum number of replicas when scaling down.
70-
<7> Specify the maximum number of replicas when scaling up.
71-
<8> Use the `metrics` parameter for memory usage.
72-
<9> Specify `memory` for memory usage.
73-
<10> Set to `Utilization`.
74-
<11> Specify `averageUtilization` and a target average memory usage over all the pods,
61+
where:
62+
+
63+
--
64+
`apiVersion`:: Specifies the `autoscaling/v2` API.
65+
`metadata.name`:: Specifies a name for this horizontal pod autoscaler object.
66+
`spec.scaleTargetRef.apiVersion`:: Specifies the API version of the object to scale:
67+
* For a `Deployment`, `ReplicaSet`, `Statefulset` object, use `apps/v1`.
68+
* For a `ReplicationController`, use `v1`.
69+
* For a `DeploymentConfig`, use `apps.openshift.io/v1`.
70+
`spec.scaleTargetRef.kind`:: Specifies the type of object. The object must be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
71+
`spec.scaleTargetRef.name`:: Specifies the name of the object to scale. The object must exist.
72+
`spec.minReplicas`:: Specifies the minimum number of replicas when scaling down.
73+
`spec.maxReplicas`:: Specifies the maximum number of replicas when scaling up.
74+
`spec.metrics`:: Specifies the parameters to calculate the desired replica count.
75+
`spec.metrics.resource.name`:: Specifies a name for the resource.
76+
`spec.metrics.resource.target.type`:: Specifies the type of target, here `Utilization` for a percentage value.
77+
`spec.metrics.resource.target.averageUtilization`:: Specifies the targeted average memory usage over all the pods,
7578
represented as a percent of requested memory. The target pods must have memory requests configured.
76-
<12> Optional: Specify a scaling policy to control the rate of scaling up or down.
79+
`spec.behavior`:: Optional: Specifies a scaling policy to control the rate of scaling up or down.
80+
--
7781

7882
. Create the horizontal pod autoscaler by using a command similar to the following:
7983
+

modules/nodes-pods-autoscaling-creating-memory-specific.adoc

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
= Creating a horizontal pod autoscaler object for specific memory use
99

10-
Using the {product-title} CLI, you can create a horizontal pod autoscaler (HPA) to automatically scale an existing object. The HPA scales the pods associated with that object to maintain the average memory use that you specify.
10+
[role="_abstract"]
11+
You can use the {product-title} CLI to create a horizontal pod autoscaler (HPA) that automatically scales an existing object. The HPA scales the pods associated with that object to maintain the average memory use that you specify.
1112

1213
[NOTE]
1314
====
@@ -26,26 +27,26 @@ include::snippets/nodes-pods-autoscaling-creating-cpu-prereqs.adoc[]
2627
+
2728
[source,yaml,options="nowrap"]
2829
----
29-
apiVersion: autoscaling/v2 <1>
30+
apiVersion: autoscaling/v2
3031
kind: HorizontalPodAutoscaler
3132
metadata:
32-
name: hpa-resource-metrics-memory <2>
33+
name: hpa-resource-metrics-memory
3334
namespace: default
3435
spec:
3536
scaleTargetRef:
36-
apiVersion: apps/v1 <3>
37-
kind: Deployment <4>
38-
name: example <5>
39-
minReplicas: 1 <6>
40-
maxReplicas: 10 <7>
41-
metrics: <8>
37+
apiVersion: apps/v1
38+
kind: Deployment
39+
name: example
40+
minReplicas: 1
41+
maxReplicas: 10
42+
metrics:
4243
- type: Resource
4344
resource:
44-
name: memory <9>
45+
name: memory
4546
target:
46-
type: AverageValue <10>
47-
averageValue: 500Mi <11>
48-
behavior: <12>
47+
type: AverageValue
48+
averageValue: 500Mi
49+
behavior:
4950
scaleDown:
5051
stabilizationWindowSeconds: 300
5152
policies:
@@ -57,22 +58,25 @@ spec:
5758
periodSeconds: 60
5859
selectPolicy: Max
5960
----
60-
<1> Use the `autoscaling/v2` API.
61-
<2> Specify a name for this horizontal pod autoscaler object.
62-
<3> Specify the API version of the object to scale:
63-
* For a `Deployment`, `ReplicaSet`, or `Statefulset` object, use `apps/v1`.
61+
where:
62+
+
63+
--
64+
`apiVersion`:: Specifies the `autoscaling/v2` API.
65+
`metadata.name`:: Specifies a name for this horizontal pod autoscaler object.
66+
`spec.scaleTargetRef.apiVersion`:: Specifies the API version of the object to scale:
67+
* For a `Deployment`, `ReplicaSet`, `Statefulset` object, use `apps/v1`.
6468
* For a `ReplicationController`, use `v1`.
6569
* For a `DeploymentConfig`, use `apps.openshift.io/v1`.
66-
<4> Specify the type of object. The object must be a `Deployment`, `DeploymentConfig`,
67-
`ReplicaSet`, `ReplicationController`, or `StatefulSet`.
68-
<5> Specify the name of the object to scale. The object must exist.
69-
<6> Specify the minimum number of replicas when scaling down.
70-
<7> Specify the maximum number of replicas when scaling up.
71-
<8> Use the `metrics` parameter for memory usage.
72-
<9> Specify `memory` for memory usage.
73-
<10> Set the type to `AverageValue`.
74-
<11> Specify `averageValue` and a specific memory value.
75-
<12> Optional: Specify a scaling policy to control the rate of scaling up or down.
70+
`spec.scaleTargetRef.kind`:: Specifies the type of object. The object must be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
71+
`spec.scaleTargetRef.name`:: Specifies the name of the object to scale. The object must exist.
72+
`spec.minReplicas`:: Specifies the minimum number of replicas when scaling down.
73+
`spec.maxReplicas`:: Specifies the maximum number of replicas when scaling up.
74+
`spec.metrics`:: Specifies the parameters to calculate the desired replica count. Set the
75+
`spec.metrics.resource.name`:: Specifies a name for the resource.
76+
`spec.metrics.resource.target.type`:: Specifies the type of target, here `AverageValue` for a specific memory value.
77+
`spec.metrics.resource.target.averageValue`:: Specifies the targeted memory value.
78+
`spec.behavior`:: Optional: Specifies a scaling policy to control the rate of scaling up or down.
79+
--
7680

7781
. Create the horizontal pod autoscaler by using a command similar to the following:
7882
+

modules/nodes-pods-autoscaling-creating-web-console-edit.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-creating-web-console-edit_{context}"]
77
= Editing a horizontal pod autoscaler by using the web console
88

9-
From the web console, you can modify a horizontal pod autoscaler (HPA) that specifies the minimum and maximum number of pods you want to run on a `Deployment` or `DeploymentConfig` object. You can also define the amount of CPU or memory usage that your pods should target.
9+
[role="_abstract"]
10+
You can use the web console to modify a horizontal pod autoscaler (HPA) that specifies the minimum and maximum number of pods you want to run on a `Deployment` or `DeploymentConfig` object. You can also define the amount of CPU or memory usage that your pods should target.
1011

1112
.Procedure
1213

@@ -15,7 +16,7 @@ From the web console, you can modify a horizontal pod autoscaler (HPA) that spec
1516
. From the *Actions* drop-down list, select *Edit HorizontalPodAutoscaler* to open the *Edit Horizontal Pod Autoscaler* form.
1617

1718
. From the *Edit Horizontal Pod Autoscaler* form, edit the minimum and maximum pod limits and the CPU and memory usage, and click *Save*.
18-
19+
+
1920
[NOTE]
2021
====
2122
While creating or editing the horizontal pod autoscaler in the web console, you can switch from *Form view* to *YAML view*.

modules/nodes-pods-autoscaling-creating-web-console-remove.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[id="nodes-pods-autoscaling-creating-web-console-remove_{context}"]
77
= Removing a horizontal pod autoscaler by using the web console
88

9-
You can remove a horizontal pod autoscaler (HPA) in the web console.
9+
[role="_abstract"]
10+
You can use the web console to remove a horizontal pod autoscaler (HPA).
1011

1112
.Procedure
1213

modules/nodes-pods-autoscaling-creating-web-console.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
[id="nodes-pods-autoscaling-creating-web-console_{context}"]
77
= Creating a horizontal pod autoscaler by using the web console
88

9-
From the web console, you can create a horizontal pod autoscaler (HPA) that specifies the minimum and maximum number of pods you want to run on a `Deployment` or `DeploymentConfig` object. You can also define the amount of CPU or memory usage that your pods should target.
9+
[role="_abstract"]
10+
You can use the web console to create a horizontal pod autoscaler (HPA) that specifies the minimum and maximum number of pods you want to run on a `Deployment` or `DeploymentConfig` object. You can also define the amount of CPU or memory usage that your pods should target.
1011

1112
[NOTE]
1213
====
1314
An HPA cannot be added to deployments that are part of an Operator-backed service, Knative service, or Helm chart.
1415
====
1516

16-
.Procedure
17+
The following procedure creates an HPA in the web console.
1718

18-
To create an HPA in the web console:
19+
.Procedure
1920

2021
. In the *Topology* view, click the node to reveal the side pane.
2122

0 commit comments

Comments
 (0)