mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
Need to update HorizontalPodAutoscaler yaml file under section Autoscaling for Memory Utilization 4.x
This commit is contained in:
committed by
openshift-cherrypick-robot
parent
960da8117b
commit
bb0d654ba8
@@ -6,8 +6,13 @@
|
||||
|
||||
= Creating a horizontal pod autoscaler for CPU utilization
|
||||
|
||||
You can create a horizontal pod autoscaler (HPA) to automatically scale pods when CPU usage exceeds a specified percentage.
|
||||
You create the HPA for a replication controller or deployment controller, based on how your pods were created.
|
||||
You can create a horizontal pod autoscaler (HPA) for an existing DeploymentConfig or ReplicationController object
|
||||
that automatically scales the Pods associated with that object in order to maintain the CPU usage you specify.
|
||||
|
||||
The HPA increases and decreases the number of replicas between the minimum and maximum numbers to maintain the specified CPU utilization across all Pods.
|
||||
|
||||
When autoscaling for CPU utilization, you can use the `oc autoscale` command and specify the minimum and maximum number of Pods you want to run at any given time and the average CPU utilization your Pods should target. If you do not specify a minimum, the Pods are given default values from the {product-title} server.
|
||||
To autoscale for a specific CPU value, create a `HorizontalPodAutoscaler` object with the target CPU and Pod limits.
|
||||
|
||||
.Prerequisites
|
||||
|
||||
@@ -45,40 +50,141 @@ Events: <none>
|
||||
|
||||
.Procedure
|
||||
|
||||
* Use one of the following commands to create a horizontal pod autoscaler for CPU utilization
|
||||
for a deployment controller or a replication controller:
|
||||
+
|
||||
----
|
||||
oc autoscale dc/<deployment-name> \//<1>
|
||||
--min <number> \//<2>
|
||||
--max <number> \//<3>
|
||||
--cpu-percent=<percent> <4>
|
||||
To create a horizontal pod autoscaler for CPU utilization:
|
||||
|
||||
oc autoscale rc/<file-name> --min <number> --max <number> --cpu-percent=<percent>
|
||||
. Perform one of the following one of the following:
|
||||
|
||||
** To scale based on the percent of CPU utilization, create a `HorizontalPodAutoscaler` object for an existing DeploymentConfig:
|
||||
+
|
||||
----
|
||||
$ oc autoscale dc/<dc-name> \// <1>
|
||||
--min <number> \// <2>
|
||||
--max <number> \// <3>
|
||||
--cpu-percent=<percent> <4>
|
||||
----
|
||||
+
|
||||
<1> Specify the deployment object or replica file.
|
||||
<1> Specify the name of the DeploymentConfig. The object must exist.
|
||||
<2> Optionally, specify the minimum number of replicas when scaling down.
|
||||
<3> Specify the maximum number of replicas when scaling up.
|
||||
<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.
|
||||
|
||||
** To scale based on the percent of CPU utilization, create a `HorizontalPodAutoscaler` object for an existing ReplicationController:
|
||||
+
|
||||
----
|
||||
$ oc autoscale rc/<rc-name> <1>
|
||||
--min <number> \// <2>
|
||||
--max <number> \// <3>
|
||||
--cpu-percent=<percent> <4>
|
||||
----
|
||||
+
|
||||
<1> Specify the name of the ReplicationController. The object must exist.
|
||||
<2> Specify the minimum number of replicas when scaling down.
|
||||
<3> Specify the maximum number of replicas when scaling up.
|
||||
<4> Specify the target average CPU utilization, represented as a percent of requested CPU, over all the pods. If not specified or negative, a default autoscaling policy will be used.
|
||||
+
|
||||
For example:
|
||||
+
|
||||
----
|
||||
oc autoscale dc/example --min=5 --max=7 --cpu-percent=75
|
||||
----
|
||||
+
|
||||
The following example shows autoscaling for the `example` deployment configuration. The initial deployment requires 3 pods. The HPA object increased that minumum to 5 and will increase the pods up to 7 if CPU usage on the pods reaches 75%:
|
||||
+
|
||||
----
|
||||
$ oc get dc example
|
||||
NAME REVISION DESIRED CURRENT TRIGGERED BY
|
||||
example 1 3 3 config
|
||||
<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.
|
||||
|
||||
$ oc autoscale dc/example --min=5 --max=7 --cpu-percent=75
|
||||
horizontalpodautoscaler.autoscaling/example autoscaled
|
||||
|
||||
$ oc get dc
|
||||
NAME REVISION DESIRED CURRENT TRIGGERED BY
|
||||
example 1 5 5 config
|
||||
** To scale for a specific CPU value, create a YAML file similar to the following for an existing DeploymentConfig or ReplicationController:
|
||||
+
|
||||
.. Create a YAML file similar to the following:
|
||||
+
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v2beta2 <1>
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: cpu-autoscale <2>
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: v1 <3>
|
||||
kind: ReplicationController <4>
|
||||
name: example <5>
|
||||
minReplicas: 1 <6>
|
||||
maxReplicas: 10 <7>
|
||||
metrics: <8>
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu <9>
|
||||
target:
|
||||
type: Utilization <10>
|
||||
averageValue: 500Mi <11>
|
||||
----
|
||||
<1> Use the `autoscaling/v2beta2` API.
|
||||
<2> Specify a name for this horizontal pod autoscaler object.
|
||||
<3> Specify the API version of the object to scale:
|
||||
* For a ReplicationController, use `v1`,
|
||||
* For a DeploymentConfig, use `apps.openshift.io/v1`.
|
||||
<4> Specify the kind of object to scale, either `ReplicationController` or `DeploymentConfig`.
|
||||
<5> Specify the name of the object to scale. The object must exist.
|
||||
<6> Specify the minimum number of replicas when scaling down.
|
||||
<7> Specify the maximum number of replicas when scaling up.
|
||||
<8> Use the `metrics` parameter for memory utilization.
|
||||
<9> Specify `cpu` for CPU utilization.
|
||||
<10> Set to `Utilization`.
|
||||
<11> Set the type to `averageValue`.
|
||||
|
||||
.. Create the horizontal pod autoscaler:
|
||||
+
|
||||
----
|
||||
$ oc create -f <file-name>.yaml
|
||||
----
|
||||
|
||||
. Verify that the horizontal pod autoscaler was created:
|
||||
+
|
||||
----
|
||||
$ oc get hpa hpa-resource-metrics-memory
|
||||
|
||||
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
|
||||
oc get hpa hpa-resource-metrics-memory ReplicationController/example 2441216/500Mi 1 10 1 20m
|
||||
----
|
||||
|
||||
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 in order to maintain an average CPU utilization of 75% across all Pods.
|
||||
|
||||
----
|
||||
$ oc autoscale dc/image-registry --min 3 --max 7 --cpu-percent=75
|
||||
deploymentconfig "image-registry" autoscaled
|
||||
----
|
||||
|
||||
The command creates a horizontal pod autoscaler with the following definition:
|
||||
|
||||
----
|
||||
$ oc edit hpa frontend -n openshift-image-registry
|
||||
----
|
||||
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
creationTimestamp: "2020-02-21T20:19:28Z"
|
||||
name: image-registry
|
||||
namespace: default
|
||||
resourceVersion: "32452"
|
||||
selfLink: /apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/frontend
|
||||
uid: 1a934a22-925d-431e-813a-d00461ad7521
|
||||
spec:
|
||||
maxReplicas: 7
|
||||
minReplicas: 3
|
||||
scaleTargetRef:
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
name: image-registry
|
||||
targetCPUUtilizationPercentage: 75
|
||||
status:
|
||||
currentReplicas: 5
|
||||
desiredReplicas: 0
|
||||
----
|
||||
|
||||
The following example shows autoscaling for the `image-registry` DeploymentConfig. 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%:
|
||||
|
||||
----
|
||||
$ oc get dc image-registry
|
||||
NAME REVISION DESIRED CURRENT TRIGGERED BY
|
||||
image-registry 1 3 3 config
|
||||
|
||||
$ oc autoscale dc/image-registry --min=5 --max=7 --cpu-percent=75
|
||||
horizontalpodautoscaler.autoscaling/image-registry autoscaled
|
||||
|
||||
$ oc get dc image-registry
|
||||
NAME REVISION DESIRED CURRENT TRIGGERED BY
|
||||
image-registry 1 5 5 config
|
||||
----
|
||||
|
||||
@@ -6,7 +6,15 @@
|
||||
|
||||
= Creating a horizontal pod autoscaler object for memory utilization
|
||||
|
||||
You can create a horizontal pod autoscaler to automatically scale pods in a Deployment when memory usage exceeds a specified limit.
|
||||
You can create a horizontal pod autoscaler (HPA) for an existing DeploymentConfig or ReplicationController object
|
||||
that automatically scales the Pods associated with that object in order to maintain the average memory utilization you specify,
|
||||
either a direct value or a percentage of requested memory.
|
||||
|
||||
The HPA increases and decreases the number of replicas between the minimum and maximum numbers to maintain
|
||||
the specified memory utilization across all Pods.
|
||||
|
||||
For memory utilization, you can specify the minimum and maximum number of Pods and the average memory utilization
|
||||
your Pods should target. If you do not specify a minimum, the Pods are given default values from the {product-title} server.
|
||||
|
||||
[IMPORTANT]
|
||||
====
|
||||
@@ -30,103 +38,118 @@ You can use the `oc describe PodMetrics <pod-name>` command to determine if metr
|
||||
configured, the output appears similar to the following, with `Cpu` and `Memory` displayed under `Usage`.
|
||||
|
||||
----
|
||||
$ oc describe PodMetrics openshift-kube-scheduler-ip-10-0-135-131.ec2.internal
|
||||
$ oc describe PodMetrics openshift-kube-scheduler-ip-10-0-129-223.compute.internal -n openshift-kube-scheduler
|
||||
----
|
||||
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
Name: openshift-kube-scheduler-ip-10-0-135-131.ec2.internal
|
||||
Name: openshift-kube-scheduler-ip-10-0-129-223.compute.internal
|
||||
Namespace: openshift-kube-scheduler
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
API Version: metrics.k8s.io/v1beta1
|
||||
Containers:
|
||||
Name: wait-for-host-port
|
||||
Name: scheduler
|
||||
Usage:
|
||||
Cpu: 2m
|
||||
Memory: 41056Ki
|
||||
Name: wait-for-host-port
|
||||
Usage:
|
||||
Memory: 0
|
||||
Name: scheduler
|
||||
Usage:
|
||||
Cpu: 8m
|
||||
Memory: 45440Ki
|
||||
Kind: PodMetrics
|
||||
Metadata:
|
||||
Creation Timestamp: 2019-05-23T18:47:56Z
|
||||
Self Link: /apis/metrics.k8s.io/v1beta1/namespaces/openshift-kube-scheduler/pods/openshift-kube-scheduler-ip-10-0-135-131.ec2.internal
|
||||
Timestamp: 2019-05-23T18:47:56Z
|
||||
Window: 1m0s
|
||||
Creation Timestamp: 2020-02-14T22:21:14Z
|
||||
Self Link: /apis/metrics.k8s.io/v1beta1/namespaces/openshift-kube-scheduler/pods/openshift-kube-scheduler-ip-10-0-129-223.compute.internal
|
||||
Timestamp: 2020-02-14T22:21:14Z
|
||||
Window: 5m0s
|
||||
Events: <none>
|
||||
|
||||
----
|
||||
|
||||
.Procedure
|
||||
|
||||
To create a horizontal pod autoscaler for memory utilization:
|
||||
|
||||
. Create a YAML file that contains one of the following:
|
||||
. Create a YAML file for one of the following:
|
||||
|
||||
** To scale for a specific memory value, create a `HorizontalPodAutoscaler` object similar to the following for an existing DeploymentConfig or ReplicationController:
|
||||
+
|
||||
.Sample HPA object for an absolute value
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2beta2 <1>
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: memory-autoscale <1>
|
||||
name: hpa-resource-metrics-memory <2>
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1 <2>
|
||||
name: example <3>
|
||||
kind: DeploymentConfig <4>
|
||||
minReplicas: 1 <5>
|
||||
maxReplicas: 10 <6>
|
||||
metrics:
|
||||
apiVersion: v1 <3>
|
||||
kind: ReplicationController <4>
|
||||
name: example <5>
|
||||
minReplicas: 1 <6>
|
||||
maxReplicas: 10 <7>
|
||||
metrics: <8>
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
name: memory <9>
|
||||
target:
|
||||
name: memory-absolute
|
||||
targetAverageValue: 500Mi <7>
|
||||
type: Utilization <10>
|
||||
averageValue: 500Mi <11>
|
||||
----
|
||||
<1> Specify the name of this horizontal pod autoscaler object.
|
||||
<2> Specify `apps/v1` as the API version of the object to scale.
|
||||
<3> Specify the name of the object to scale.
|
||||
<4> Specify the kind of object to scale.
|
||||
<5> Specify the minimum number of replicas when scaling down.
|
||||
<6> Specify the maximum number of replicas when scaling up.
|
||||
<7> Specify the average amount of memory used per pod.
|
||||
<1> Use the `autoscaling/v2beta2` API.
|
||||
<2> Specify a name for this horizontal pod autoscaler object.
|
||||
<3> Specify the API version of the object to scale:
|
||||
* For a ReplicationController, use `v1`,
|
||||
* For a DeploymentConfig, use `apps.openshift.io/v1`.
|
||||
<4> Specify the kind of object to scale, either `ReplicationController` or `DeploymentConfig`.
|
||||
<5> Specify the name of the object to scale. The object must exist.
|
||||
<6> Specify the minimum number of replicas when scaling down.
|
||||
<7> Specify the maximum number of replicas when scaling up.
|
||||
<8> Use the `metrics` parameter for memory utilization.
|
||||
<9> Specify `memory` for memory utilization.
|
||||
<10> Set the type to `Utilization`.
|
||||
<11> Specify `averageValue` and a specific memory value.
|
||||
|
||||
.Sample HPA object for a percentage
|
||||
** To scale for a percentage, create a `HorizontalPodAutoscaler` object similar to the following:
|
||||
+
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v2beta2
|
||||
apiVersion: autoscaling/v2beta2 <1>
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: memory-autoscale <1>
|
||||
name: memory-autoscale <2>
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1 <2>
|
||||
name: example <3>
|
||||
apiVersion: apps.openshift.io/v1 <3>
|
||||
kind: DeploymentConfig <4>
|
||||
minReplicas: 1 <5>
|
||||
maxReplicas: 10 <6>
|
||||
name: example <5>
|
||||
minReplicas: 1 <6>
|
||||
maxReplicas: 10 <7>
|
||||
metrics:
|
||||
metrics: <8>
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
name: memory <9>
|
||||
target:
|
||||
name: memory-percent
|
||||
type: Utilization
|
||||
averageUtilization: 50 <7>
|
||||
type: Utilization <10>
|
||||
averageValue: 50 <11>
|
||||
----
|
||||
<1> Specify the name of this horizontal pod autoscaler object.
|
||||
<2> Specify `apps/v1` as the API version of the object to scale.
|
||||
<3> Specify the name of the object to scale.
|
||||
<4> Specify the kind of object to scale.
|
||||
<5> Specify the minimum number of replicas when scaling down.
|
||||
<6> Specify the maximum number of replicas when scaling up.
|
||||
<7> The average percentage of the requested memory that each pod should be using.
|
||||
<1> Use the `autoscaling/v2beta2` API.
|
||||
<2> Specify a name for this horizontal pod autoscaler object.
|
||||
<3> Specify the API version of the object to scale:
|
||||
* For a ReplicationController, use `v1`,
|
||||
* For a DeploymentConfig, use `apps.openshift.io/v1`.
|
||||
<4> Specify the kind of object to scale, either `ReplicationController` or `DeploymentConfig`.
|
||||
<5> Specify the name of the object to scale. The object must exist.
|
||||
<6> Specify the minimum number of replicas when scaling down.
|
||||
<7> Specify the maximum number of replicas when scaling up.
|
||||
<8> Use the `metrics` parameter for memory utilization.
|
||||
<9> Specify `memory` for memory utilization.
|
||||
<10> Set to `Utilization`.
|
||||
<11> Specify `averageUtilization` or `averageValue` and a memory value.
|
||||
|
||||
. Create the autoscaler from the above file:
|
||||
. Create the horizontal pod autoscaler:
|
||||
+
|
||||
----
|
||||
$ oc create -f <file-name>.yaml
|
||||
@@ -140,28 +163,36 @@ $ oc create -f hpa.yaml
|
||||
horizontalpodautoscaler.autoscaling/hpa-resource-metrics-memory created
|
||||
----
|
||||
|
||||
. Verify that the HPA was created:
|
||||
. Verify that the horizontal pod autoscaler was created:
|
||||
+
|
||||
----
|
||||
$ oc get hpa memory-autoscale
|
||||
$ oc get hpa hpa-resource-metrics-memory
|
||||
|
||||
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
|
||||
memory-autoscale DeploymentConfig/example <unknown>/500Mi 1 10 0 56s
|
||||
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
|
||||
oc get hpa hpa-resource-metrics-memory ReplicationController/example 2441216/500Mi 1 10 1 20m
|
||||
----
|
||||
+
|
||||
----
|
||||
$ oc describe hpa memory-autoscale
|
||||
|
||||
Name: memory-autoscale
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Wed, 22 May 2019 20:56:35 -0400
|
||||
Reference: DeploymentConfig/example
|
||||
Metrics: ( current / target )
|
||||
resource cpu on pods (as a percentage of request): <unknown>/500Mi
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
DeploymentConfig pods: 0 current / 0 desired
|
||||
Events: <none>
|
||||
$ oc describe hpa hpa-resource-metrics-memory
|
||||
Name: hpa-resource-metrics-memory
|
||||
Namespace: default
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
CreationTimestamp: Wed, 04 Mar 2020 16:31:37 +0530
|
||||
Reference: ReplicationController/example
|
||||
Metrics: ( current / target )
|
||||
resource memory on pods: 2441216 / 500Mi
|
||||
Min replicas: 1
|
||||
Max replicas: 10
|
||||
ReplicationController pods: 1 current / 1 desired
|
||||
Conditions:
|
||||
Type Status Reason Message
|
||||
---- ------ ------ -------
|
||||
AbleToScale True ReadyForNewScale recommended size matches current size
|
||||
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource
|
||||
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
|
||||
Events:
|
||||
Type Reason Age From Message
|
||||
---- ------ ---- ---- -------
|
||||
Normal SuccessfulRescale 6m34s horizontal-pod-autoscaler New size: 1; reason: All metrics below target
|
||||
----
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
// Module included in the following assemblies:
|
||||
//
|
||||
// * nodes/nodes-pods-autoscaling-about.adoc
|
||||
|
||||
[id="nodes-pods-autoscaling-creating_{context}"]
|
||||
= Understanding how to create a horizontal pod autoscaler
|
||||
|
||||
How you create the horizontal pod autoscaler (HPA) depends on whether you want to scale for CPU or memory utilization.
|
||||
|
||||
CPU utilization::
|
||||
For CPU utilization:, you can create a horizontal pod autoscaler using the command line or by
|
||||
creating a `HorizontalPodAutoscaler` object.
|
||||
|
||||
When creating an HPA to control pod scaling based on CPU utilization, you specify the maximum number of pods
|
||||
you want to run at any given time. You can also specify a minimum number of pods.
|
||||
|
||||
The following command creates a Horizontal Pod Autoscaler that maintains between 1 and 10 replicas of the Pods controlled by the `image-registry` DeploymentConfig to maintain an average CPU utilization of 50% across all Pods.
|
||||
|
||||
----
|
||||
$ oc autoscale dc/image-registry --min 1 --max 10 --cpu-percent=50
|
||||
----
|
||||
|
||||
The command creates the following object configuration:
|
||||
|
||||
.Horizontal Pod Autoscaler Object Definition for CPU utilization
|
||||
|
||||
----
|
||||
$ oc edit hpa image-registry
|
||||
----
|
||||
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v1
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
annotations:
|
||||
autoscaling.alpha.kubernetes.io/conditions: '[{"type":"AbleToScale","status":"True","lastTransitionTime":"2019-05-22T20:49:57Z","reason":"SucceededGetScale","message":"the
|
||||
HPA controller was able to get the target''s current scale"},{"type":"ScalingActive","status":"False","lastTransitionTime":"2019-05-22T20:49:57Z","reason":"FailedGetResourceMetric","message":"the
|
||||
HPA was unable to compute the replica count: missing request for cpu"}]'
|
||||
creationTimestamp: 2019-05-22T20:49:42Z
|
||||
name: image-registry <1>
|
||||
namespace: default
|
||||
resourceVersion: "325215"
|
||||
selfLink: /apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/image-registry
|
||||
uid: 1fd7585a-7cd3-11e9-9d00-0e2a93384702
|
||||
spec:
|
||||
maxReplicas: 10 <2>
|
||||
minReplicas: 1 <3>
|
||||
scaleTargetRef:
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig <4>
|
||||
name: image-registry <5>
|
||||
targetCPUUtilizationPercentage: 50 <6>
|
||||
status:
|
||||
currentReplicas: 3
|
||||
desiredReplicas: 0
|
||||
----
|
||||
<1> The name of this horizontal pod autoscaler object.
|
||||
<2> The lower limit for the number of pods that can be set by the autoscaler. If not specified or negative, the server will apply a default value.
|
||||
<3> The upper limit for the number of pods that can be set by the autoscaler. This value is required.
|
||||
<4> The kind of object to scale, DeploymentConfig or ReplicationController.
|
||||
<5> The name of the object to scale.
|
||||
<6> The percentage of the requested CPU that each pod should ideally be using.
|
||||
|
||||
Memory utilization::
|
||||
For memory utilization, you can specify the minimum number of pods and the average memory utilization
|
||||
your pods should target as well, otherwise those are given default values from
|
||||
the {product-title} server.
|
||||
|
||||
You can specify resource metrics in terms of direct values, instead of as percentages
|
||||
of the requested value, by using a target type of `AverageValue` instead of `AverageUtilization`,
|
||||
and setting the corresponding `target.averageValue` field instead of the `target.averageUtilization`.
|
||||
|
||||
.Horizontal Pod Autoscaler Object Definition for memory utilization
|
||||
[source,yaml,options="nowrap"]
|
||||
----
|
||||
apiVersion: autoscaling/v2beta2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: memory-autoscale <1>
|
||||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1 <2>
|
||||
name: example <3>
|
||||
kind: DeploymentConfig <4>
|
||||
minReplicas: 1 <5>
|
||||
maxReplicas: 10 <6>
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization <7>
|
||||
averageUtilization: 50
|
||||
----
|
||||
<1> The name of this horizontal pod autoscaler object.
|
||||
<2> The API version of the object to scale.
|
||||
<3> The name of the object to scale.
|
||||
<4> The kind of object to scale.
|
||||
<5> The lower limit for the number of pods that can be set by the autoscaler. If not specified or negative, the server will apply a default value.
|
||||
<6> The upper limit for the number of pods that can be set by the autoscaler. This value is required.
|
||||
<7> The type of must be either Utilization, Value, or AverageValue.
|
||||
@@ -19,11 +19,9 @@ configuration.
|
||||
|
||||
include::modules/nodes-pods-autoscaling-about.adoc[leveloffset=+1]
|
||||
|
||||
include::modules/nodes-pods-autoscaling-creating.adoc[leveloffset=+1]
|
||||
include::modules/nodes-pods-autoscaling-creating-cpu.adoc[leveloffset=+1]
|
||||
|
||||
include::modules/nodes-pods-autoscaling-creating-cpu.adoc[leveloffset=+2]
|
||||
|
||||
include::modules/nodes-pods-autoscaling-creating-memory.adoc[leveloffset=+2]
|
||||
include::modules/nodes-pods-autoscaling-creating-memory.adoc[leveloffset=+1]
|
||||
|
||||
include::modules/nodes-pods-autoscaling-status-about.adoc[leveloffset=+1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user