All Products
Search
Document Center

Container Service for Kubernetes:Use ack-autoscaling-placeholder to scale pods within seconds

Last Updated:Jun 04, 2025

If your business requires quick startup without considering node resource limits, you can use the ack-autoscaling-placeholder component. This component provides a buffer for cluster auto scaling. When node resources are insufficient, the actual workload preempts the pre-reserved resources to achieve quick startup. This works in conjunction with node auto scaling to force cluster scaling at the node level. This topic describes how to use ack-autoscaling-placeholder to scale pods within seconds.

Operation process

image

Prerequisites

  • Auto scaling is enabled for the Container Service for Kubernetes (ACK) cluster and an elastic node pool is configured. For more information, see Enable node auto scaling.

  • Node labels are configured for the elastic node pool to schedule workloads to the specified node pool for result verification. For more information, see Create and manage a node pool.

    This topic uses the demo=yes label as an example.

Step 1: Deploy the ack-autoscaling-placeholder component and create a placeholder workload

ack-autoscaling-placeholder provides a buffer for cluster auto scaling. This allows cluster nodes to be over-provisioned and preheated in advance and ensures that workloads can be scaled quickly without waiting for nodes to be created and join the cluster.

  1. Log on to the ACK console. In the left-side navigation pane, choose Marketplace > Marketplace.

  2. On the App Catalog tab, search for ack-autoscaling-placeholder, and then click ack-autoscaling-placeholder.

  3. On the ack-autoscaling-placeholder page, click Deploy.

  4. In the Deploy panel, complete the configuration as prompted, and then click OK.

    Replace the Parameters in the Parameters tab with the following YAML example.

    View the YAML file

    nameOverride: ""
    fullnameOverride: ""
    ##
    priorityClassDefault:
      enabled: true
      name: default-priority-class   #Default priority is low.
      value: -1
    
    ##
    deployments:
       - name: ack-place-holder
         replicaCount: 1
         containers:
           - name: placeholder
             image: registry-vpc.cn-shenzhen.aliyuncs.com/acs/pause:3.1
             pullPolicy: IfNotPresent
             resources:
               requests:
                 cpu: 4            #Resource placeholder: 4 vCPUs and 8 GB of memory
                 memory: 8               
         imagePullSecrets: {}
         annotations: {}
         nodeSelector:        #Node selector. This parameter must be consistent with the label of the elastic node pool.
           demo: "yes"  
         tolerations: []
         affinity: {}
         labels: {}

    After the creation, on the Applications > Helm page, you can see that the status of the application is Deployed.

Step 2: Create PriorityClass for the actual workload

  1. Create a file named priorityClass.yaml and copy the following content to the file:

    apiVersion: scheduling.k8s.io/v1
    kind: PriorityClass
    metadata:
      name: high-priority
    value: 1000000       #Configure priority, which should be higher than the default priority of the placeholder pod in the previous step.
    globalDefault: false
    description: "This priority class should be used for XYZ service pods only."
  2. Run the following command to deploy the PriorityClass for the actual workload:

    kubectl apply -f priorityClass.yaml

    Expected output:

    priorityclass.scheduling.k8s.io/high-priority created

Step 3: Create the actual workload

  1. Create a file named workload.yaml and copy the following content to the file:

    View YAML example

    apiVersion: apps/v1 
    kind: Deployment
    metadata:
      name: placeholder-test
      labels:
        app: nginx
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          nodeSelector:    #Node selector. This parameter must be consistent with the label of the elastic node pool.
            demo: "yes"
          priorityClassName: high-priority     # Set this parameter to the PriorityClass name configured in the previous step.
          containers:
          - name: nginx
            image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6 
            ports:
            - containerPort: 80
            resources:       
              requests:      
                cpu: 3         #Resource requirements for the actual workload.
                memory: 5
  2. Run the following command to deploy the actual workload:

    kubectl apply -f workload.yaml

    Expected output:

    deployment.apps/placeholder-test created

Verify the results

  1. After the placeholder workload ack-place-holder is created, the pod status is running.

    image

  2. When deploying an actual workload, a configured high-priority PriorityClass preempts the resources of the placeholder workload to achieve a quick start. The pods of the placeholder workload are evicted and remain in a Pending status due to insufficient node resources.

    • The actual workload placeholder-test is quickly deployed on the node where the placeholder workload is located.

      image

    • The placeholder workload is evicted and in a Pending status.

      image

  3. Due to the auto scaling feature being enabled for the node pool, insufficient node resources trigger node scaling, and the placeholder workload is scheduled to the newly scaled node in the running state.

    image

References

For more information about how to enable auto scaling for cross-zone deployment in high availability scenarios, see Implement rapid scaling across multiple zones.