Use Kubernetes YAML files to configure scaling configurations of the Elastic Container Instance type

Updated at:
Copy as MD

Configure a Kubernetes Deployment YAML file in the Auto Scaling console to create a scaling configuration of the Elastic Container Instance (ECI) type. The scaling configuration acts as a template that defines how elastic container instances are launched during scale-out events, so you can run serverless containers without managing underlying nodes or clusters.

Prerequisites

Before you begin, ensure that you have:

Limitations

  • Kubernetes Deployments only. Scaling configurations of the ECI type support only Kubernetes Deployment resources. Cluster-level configurations — such as node pools and cluster networking — operate at the cluster scope and do not apply to ECI scaling configurations. Only fields that belong to a Kubernetes Deployment take effect.

  • `spec.replicas` has no effect. Instance count is controlled by the scaling group's Expected Number of Instances setting, not by spec.replicas in the YAML file.

  • ECI-specific options require annotations. To configure options beyond Kubernetes native fields — such as the virtual private cloud (VPC), vSwitch, and security group — add them to metadata.annotations in the YAML file. For the full list of supported YAML fields and annotations, see List of supported YAML fields and annotations.

Create a scaling configuration

Step 1: Create the scaling configuration from a Kubernetes Deployment

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, click Scaling Groups.

  3. In the top navigation bar, select a region.

  4. Open the scaling group details page using one of the following methods:

    • Click the ID of the scaling group in the Scaling Group Name/ID column.

    • Click Details in the Actions column.

  5. Click the Instance Configuration Sources tab.

  6. On the Scaling Configurations tab, click Create Scaling Configuration.

  7. Click the Create By YAML File tab and edit the Deployment YAML. The following table describes the fields you must update for your environment:

    FieldDescription
    imageThe container image for your workload. Replace the sample public image (for example, registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:latest) with your own image URI, including images from a private registry inside a VPC. You can also configure parameters such as spec.template.spec.containers.livenessProbe and spec.template.spec.containers.readinessProbe.
    annotationsECI-specific configuration. In the Edit Extended Fields panel on the right, set the VPC, vSwitch, and Security Group. The console automatically inserts the corresponding annotation entries into the YAML on the left. If you leave these fields blank, Auto Scaling uses the default VPC and vSwitch. If no default exists, Auto Scaling creates one. For more information, see Default VPCs and default vSwitches.

    yaml-伸缩配置.png

  8. Click Create. In the Confirm Information dialog, review the configuration and click Confirm.

    伸缩配置.png

  9. In the Enable Scaling Configuration dialog, click OK.

Step 2: Verify the scaling configuration

  1. On the Instance Configuration Sources tab, confirm that the new scaling configuration appears with the correct details.

    查看伸缩配置.png

  2. Trigger a scale-out event to confirm that elastic container instances are created as expected. Set Expected Number of Instances for the scaling group to 2. Auto Scaling creates two elastic container instances based on your scaling configuration. To verify, check the instances list in the scaling group. For instructions, see View instances in a scaling group.

    ECI实例.png

(Optional) Step 3: View and download the YAML file

  1. On the Instance Configuration Sources tab, go to the Scaling Configurations tab.

  2. Find the scaling configuration and click View YAML in the Actions column. The effective YAML file is displayed.

    查看YAML.png

  3. Click Download to save the file in .yaml format to your local machine.

What's next

To create a scaling configuration programmatically, call the ApplyEciScalingConfiguration API operation with your Deployment YAML file.