This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.26.5. CPU 사용률의 자동 스케일링
oc autoscale
명령을 사용하여 언제든지 실행할 최대 Pod 수를 지정합니다. 선택 옵션으로 최소 Pod 수와 Pod에서 목표로 하는 평균 CPU 사용률을 지정할 수 있습니다. 그러지 않으면 OpenShift Container Platform 서버에서 기본값이 지정됩니다.
예를 들어 다음과 같습니다.
oc autoscale dc/frontend --min 1 --max 10 --cpu-percent=80
$ oc autoscale dc/frontend --min 1 --max 10 --cpu-percent=80
deploymentconfig "frontend" autoscaled
위 예제에서는 수평 Pod 자동 스케일러의 autoscaling/v1
버전을 사용할 때 다음과 같은 정의로 수평 Pod 자동 스케일러를 생성합니다.
예 26.1. 수평 Pod 자동 스케일러 오브젝트 정의
apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: frontend spec: scaleTargetRef: kind: DeploymentConfig name: frontend apiVersion: apps/v1 subresource: scale minReplicas: 1 maxReplicas: 10 targetCPUUtilizationPercentage: 80
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: frontend
spec:
scaleTargetRef:
kind: DeploymentConfig
name: frontend
apiVersion: apps/v1
subresource: scale
minReplicas: 1
maxReplicas: 10
targetCPUUtilizationPercentage: 80
또는 oc autoscale
명령은 수평 Pod 자동 스케일러의 v2beta1
버전을 사용할 때 다음 정의로 수평 Pod 자동 스케일러를 생성합니다.
apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: hpa-resource-metrics-cpu spec: scaleTargetRef: apiVersion: apps/v1 kind: ReplicationController name: hello-hpa-cpu minReplicas: 1 maxReplicas: 10 metrics: - type: Resource resource: name: cpu targetAverageUtilization: 50
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: hpa-resource-metrics-cpu
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: ReplicationController
name: hello-hpa-cpu
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 50