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-autoscaling-about.adoc
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,8 @@
6
6
[id="nodes-pods-autoscaling-about_{context}"]
7
7
= Understanding horizontal pod autoscalers
8
8
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.
10
11
11
12
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.
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.
10
11
11
12
All pods must have resource requests configured::
12
13
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.
= Creating a horizontal pod autoscaler for a percent of CPU use
8
8
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.
10
11
11
12
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.
<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
+
--
38
42
+
39
43
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:
= Creating a horizontal pod autoscaler for a specific CPU value
8
8
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.
<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:
49
53
* For a `Deployment`, `ReplicaSet`, `Statefulset` object, use `apps/v1`.
50
54
* For a `ReplicationController`, use `v1`.
51
55
* 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.
= Creating a horizontal pod autoscaler by using the CLI
8
8
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.
10
11
11
12
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.
Copy file name to clipboardExpand all lines: modules/nodes-pods-autoscaling-creating-memory-percent.adoc
+33-29Lines changed: 33 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,8 @@
7
7
8
8
= Creating a horizontal pod autoscaler object for a percent of memory use
9
9
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.
<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,
75
78
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
+
--
77
81
78
82
. Create the horizontal pod autoscaler by using a command similar to the following:
Copy file name to clipboardExpand all lines: modules/nodes-pods-autoscaling-creating-memory-specific.adoc
+31-27Lines changed: 31 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,8 @@
7
7
8
8
= Creating a horizontal pod autoscaler object for specific memory use
9
9
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.
<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`.
64
68
* For a `ReplicationController`, use `v1`.
65
69
* 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
+
--
76
80
77
81
. Create the horizontal pod autoscaler by using a command similar to the following:
= Editing a horizontal pod autoscaler by using the web console
8
8
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.
10
11
11
12
.Procedure
12
13
@@ -15,7 +16,7 @@ From the web console, you can modify a horizontal pod autoscaler (HPA) that spec
15
16
. From the *Actions* drop-down list, select *Edit HorizontalPodAutoscaler* to open the *Edit Horizontal Pod Autoscaler* form.
16
17
17
18
. 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
+
+
19
20
[NOTE]
20
21
====
21
22
While creating or editing the horizontal pod autoscaler in the web console, you can switch from *Form view* to *YAML view*.
= Creating a horizontal pod autoscaler by using the web console
8
8
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.
10
11
11
12
[NOTE]
12
13
====
13
14
An HPA cannot be added to deployments that are part of an Operator-backed service, Knative service, or Helm chart.
14
15
====
15
16
16
-
.Procedure
17
+
The following procedure creates an HPA in the web console.
17
18
18
-
To create an HPA in the web console:
19
+
.Procedure
19
20
20
21
. In the *Topology* view, click the node to reveal the side pane.
0 commit comments