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
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,3 +64,54 @@ Use the {product-title} web console to check the memory behavior of your applica
64
64
and ensure that your application meets these requirements before using
65
65
memory-based autoscaling.
66
66
====
67
+
68
+
The following example shows autoscaling for the `image-registry` `DeploymentConfig` object. The initial deployment requires 3 pods. The HPA object increased that minimum to 5 and will increase the pods up to 7 if CPU usage on the pods reaches 75%:
Copy file name to clipboardExpand all lines: modules/nodes-pods-autoscaling-creating-cpu.adoc
+13-99Lines changed: 13 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,7 @@
6
6
7
7
= Creating a horizontal pod autoscaler for CPU utilization by using the CLI
8
8
9
-
You can create a horizontal pod autoscaler (HPA) for an existing `DeploymentConfig` or `ReplicationController` object
10
-
that automatically scales the pods associated with that object to maintain the CPU usage you specify.
9
+
You can create a horizontal pod autoscaler (HPA) for an existing `Deployment`, `DeploymentConfig`, `ReplicaSet`, `ReplicationController`, or `StatefulSet` object that automatically scales the pods associated with that object to maintain the CPU usage you specify.
11
10
12
11
The HPA increases and decreases the number of replicas between the minimum and maximum numbers to maintain the specified CPU utilization across all pods.
13
12
@@ -56,37 +55,29 @@ To create a horizontal pod autoscaler for CPU utilization:
56
55
57
56
. Perform one of the following one of the following:
58
57
59
-
** To scale based on the percent of CPU utilization, create a `HorizontalPodAutoscaler` object for an existing `DeploymentConfig` object:
58
+
** To scale based on the percent of CPU utilization, create a `HorizontalPodAutoscaler` object for an existing object:
60
59
+
61
60
[source,terminal]
62
61
----
63
-
$ oc autoscale dc/<dc-name> \// <1>
62
+
$ oc autoscale <object_type>/<name> \// <1>
64
63
--min <number> \// <2>
65
64
--max <number> \// <3>
66
65
--cpu-percent=<percent> <4>
67
66
----
68
67
+
69
-
<1> Specify the name of the `DeploymentConfig` object. The object must exist.
68
+
<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`.
70
69
<2> Optionally, specify the minimum number of replicas when scaling down.
71
70
<3> Specify the maximum number of replicas when scaling up.
72
71
<4> Specify the target average CPU utilization over all the pods, represented as a percent of requested CPU. If not specified or negative, a default autoscaling policy is used.
73
-
74
-
** To scale based on the percent of CPU utilization, create a `HorizontalPodAutoscaler` object for an existing replication controller:
72
+
+
73
+
For example, the following command shows autoscaling for the `image-registry` `DeploymentConfig` object. The initial deployment requires 3 pods. The HPA object increased that minimum to 5 and will increase the pods up to 7 if CPU usage on the pods reaches 75%:
<1> Specify the name of the replication controller. The object must exist.
85
-
<2> Specify the minimum number of replicas when scaling down.
86
-
<3> Specify the maximum number of replicas when scaling up.
87
-
<4> Specify the target average CPU utilization over all the pods, represented as a percent of requested CPU. If not specified or negative, a default autoscaling policy is used.
88
79
89
-
** To scale for a specific CPU value, create a YAML file similar to the following for an existing `DeploymentConfig` object or replication controller:
80
+
** To scale for a specific CPU value, create a YAML file similar to the following for an existing object:
90
81
+
91
82
.. Create a YAML file similar to the following:
92
83
+
@@ -100,7 +91,7 @@ metadata:
100
91
spec:
101
92
scaleTargetRef:
102
93
apiVersion: v1 <3>
103
-
kind: ReplicationController <4>
94
+
kind: ReplicaSet <4>
104
95
name: example <5>
105
96
minReplicas: 1 <6>
106
97
maxReplicas: 10 <7>
@@ -115,9 +106,10 @@ spec:
115
106
<1> Use the `autoscaling/v2beta2` API.
116
107
<2> Specify a name for this horizontal pod autoscaler object.
117
108
<3> Specify the API version of the object to scale:
118
-
* For a replication controller, use `v1`,
119
-
* For a `DeploymentConfig` object, use `apps.openshift.io/v1`.
120
-
<4> Specify the kind of object to scale, either `ReplicationController` or `DeploymentConfig`.
109
+
* For a `ReplicationController`, use `v1`.
110
+
* For a `DeploymentConfig`, use `apps.openshift.io/v1`.
111
+
* For a `Deployment`, `ReplicaSet`, `Statefulset` object, use `apps/v1`.
112
+
<4> Specify the type of object. The object must be a `Deployment`, `DeploymentConfig`/`dc`, `ReplicaSet`/`rs`, `ReplicationController`/`rc`, or `StatefulSet`.
121
113
<5> Specify the name of the object to scale. The object must exist.
122
114
<6> Specify the minimum number of replicas when scaling down.
123
115
<7> Specify the maximum number of replicas when scaling up.
@@ -147,81 +139,3 @@ NAME REFERENCE TARGETS MINPODS MAXPOD
For example, the following command creates a horizontal pod autoscaler that maintains between 3 and 7 replicas of the pods that are controlled by the `image-registry` `DeploymentConfig` object to maintain an average CPU utilization of 75% across all pods.
.Sample HPA for the `image-registry` `DeploymentConfig` object with `minReplicas` set to 3
164
-
[source,yaml]
165
-
----
166
-
apiVersion: autoscaling/v1
167
-
kind: HorizontalPodAutoscaler
168
-
metadata:
169
-
name: image-registry
170
-
namespace: default
171
-
spec:
172
-
maxReplicas: 7
173
-
minReplicas: 3
174
-
scaleTargetRef:
175
-
apiVersion: apps.openshift.io/v1
176
-
kind: DeploymentConfig
177
-
name: image-registry
178
-
targetCPUUtilizationPercentage: 75
179
-
status:
180
-
currentReplicas: 5
181
-
desiredReplicas: 0
182
-
----
183
-
184
-
The following example shows autoscaling for the `image-registry` `DeploymentConfig` object. The initial deployment requires 3 pods. The HPA object increased that minimum to 5 and will increase the pods up to 7 if CPU usage on the pods reaches 75%:
185
-
186
-
. View the current state of the `image-registry` deployment:
187
-
+
188
-
[source,terminal]
189
-
----
190
-
$ oc get dc image-registry
191
-
----
192
-
+
193
-
.Example output
194
-
[source,terminal]
195
-
----
196
-
NAME REVISION DESIRED CURRENT TRIGGERED BY
197
-
image-registry 1 3 3 config
198
-
----
199
-
200
-
. Autoscale the `image-registry` `DeploymentConfig` object:
Copy file name to clipboardExpand all lines: modules/nodes-pods-autoscaling-creating-memory.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ To create a horizontal pod autoscaler for memory utilization:
58
58
59
59
. Create a YAML file for one of the following:
60
60
61
-
** To scale for a specific memory value, create a `HorizontalPodAutoscaler` object similar to the following for an existing `DeploymentConfig` object or replication controller:
61
+
** To scale for a specific memory value, create a `HorizontalPodAutoscaler` object similar to the following for an existing `ReplicationController` object or replication controller:
0 commit comments