In some scenarios, you need to create a large number of Elastic Container Instances (ECIs) to handle burst traffic or processing jobs. In the worst case, the instances of the specified instance type may be out of stock in the zone or the IP addresses of the specified VSwitch may be exhausted. In this case, the ECIs fail to be created, affecting your business. You can specify multiple zones for creating an ECI to improve the success rate of creating the ECI.
Limits
- The specified VSwitches must belong to the same Virtual Private Cloud (VPC). You can specify up to 10 VSwitches.
How it works
- The system distributes the requests for creating ECIs to all VSwitches at random to relieve the pressure.
- If the ECI to be created in a request is out of stock in the target zone, the system automatically switches to another VSwitch to create the ECI in another zone.
virtual node
level. That is, the setting affects the creation of all pods to be scheduled to the
virtual node.
Kubernetes mode
Serverless Kubernetes cluster
Alibaba Cloud Serverless Kubernetes supports specifying multiple zones for creating an ECI in a serverless Kubernetes cluster.
Specify multiple zones when creating a serverless Kubernetes cluster
When you create a serverless Kubernetes cluster, you can select an existing VPC and select multiple VSwitches in the VPC to specify multiple zones, as shown in the following figure.

Specify multiple zones for an existing serverless Kubernetes cluster
A serverless Kubernetes cluster is maintained by the administrator. To specify multiple zones, contact the administrator and provide the prepared VSwitch IDs to the administrator.
Container Service for Kubernetes cluster or user-created Kubernetes cluster
Virtual Kubelet is deployed as a deployment. You can modify the ECI_VSWITCH
environment variable for the deployment to specify multiple zones. To do so, follow
these steps:
1. Open the configuration file of the deployment and add the IDs of the required VSwitches
to the value of the ECI_VSWITCH
environment variable. Separate multiple IDs with commas (,).
# Generally, the deployment is deployed in kube-system namespace and named ack-virtual-node-controller. The namespace and deployment name can be customized and may be different.
$ kubectl -n kube-system edit deployment/ack-virtual-node-controller
# Add the IDs of the required VSwitches to the value of the ECI_VSWITCH environment variable.
- name: ECI_VSWITCH
value: "vsw-bp1xpiowfm5vo8o3c3fny,vsw-bp1rkyjgr1xwoho6ko3zp"
2. After the modification is complete, save the configuration file.
API mode
When you call the CreateContainerGroup operation to create an ECI, you can specify multiple zones through the VSwitchId parameter and specify multiple instance types through the InstanceType parameter. For more information about other parameters, see CreateContainerGroup.
The following table describes the parameters that you need to set in the request.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
VSwitchId | String | Yes | vsw-*** | The ID of the VSwitch used to create the ECI. You can specify up to 10 VSwitches IDs separated with commas (,). Example: vsw-***,vsw-***. |
InstanceType | String | No | ecs.c5.xlarge | The instance type of the ECI to be created. You can specify up to five instance types separated with commas (,). Example: ecs.c5.xlarge,ecs.g5.xlarge. |
Specify multiple instance types for creating an ECI
You can specify multiple zones and multiple instance types at the same time. This greatly improves the success rate of creating ECIs. For more information, see Specify multiple instance types for creating an ECI.