Configuring HPA for Auto Scaling
Overview
CCI 2.0 allows you to configure HorizontalPodAutoscaler (HPA) to automatically scale Deployments.
HPA periodically scales Deployments to match observed metrics, such as average vCPU usage, average memory usage, or any custom metrics you specify.
Procedure
- Log in to the CCI 2.0 console. In the navigation pane, choose Workloads. On the Deployments tab, click the workload name to go to the workload details page.
- Click Auto Scaling and then Create from YAML to create an HPA policy.
The following is an example YAML file for creating an HPA policy:
kind: HorizontalPodAutoscaler apiVersion: cci/v2 metadata: name: alpha-test-hpa namespace: cci-test # Namespace spec: scaleTargetRef: kind: Deployment name: nginx apiVersion: cci/v2 minReplicas: 1 # Minimum number of replicas maxReplicas: 5 # Maximum number of replicas metrics: - type: Resource resource: name: memory # vCPU or memory metrics target: type: Utilization # Scaling type averageUtilization: 50 # Average resource usage that triggers scaling - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 50
- On the workload details page, select a pod and click View Terminal. Then, run the following command:
while true; do curl 127.0.0.1:80; done
Wait until the HPA is triggered, the workload is scaled out, and an event is reported.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot