Updated on 2025-08-12 GMT+08:00

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

  1. 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.

  2. 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

  3. 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.