All Products
Search
Document Center

Elastic Container Instance:Configure multiple zones to create an elastic container instance

Last Updated:Mar 07, 2024

In some cases, you need to create a large number of elastic container instances to handle bursts of traffic or process jobs. However, if the resources in the zone that you specify are insufficient or the vSwitch that you specify does not have available IP addresses, no instances can be created. To address this issue, you can configure multiple zones to ensure sufficient available resources when you create elastic container instances. This topic describes how to configure multiple zones to create elastic container instances.

Prerequisites

vSwitches are created in different zones of the virtual private cloud (VPC) where you want to create an elastic container instance.

Background information

When you create an elastic container instance, you can specify multiple zones by specifying multiple vSwitches. Then, the system distributes the requests to all the specified zones at random. If requested resources are insufficient in a zone, the system tries to create the instance in a different zone.

When you specify multiple zones (vSwitches), take note of the following items:

  • The specified vSwitches must belong to the same VPC.

  • Up to 10 vSwitches can be specified.

You can specify multiple instance specifications and multiple zones at the same time to further improve the success rate of creating elastic container instances.

Configuration description

OpenAPI

If you create an elastic container instance by calling the CreateContainerGroup operation, you can use the VSwitchId parameter to specify multiple zones and use the ScheduleStrategy parameter to set the scheduling policy for multiple zones. The following table describes the parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

VSwitchId

String

vsw-bp1xpiowfm5vo8o3c****,vsw-bp1rkyjgr1xwoho6k****

The IDs of vSwitches. You can specify up to 10 vSwitch IDs at a time. Separate multiple vSwitch IDs with commas (,). Example: vsw-***,vsw-***.

ScheduleStrategy

String

VSwitchOrdered

The resource scheduling policy when you specify multiple zones to create an elastic container instance.

  • VSwitchOrdered: The system schedules resources in sequence. Rule details:

    1. If you want to mount a disk to the pod that you are creating, the zone of the disk must be the same as the zone of the pod. The zones that cannot provide both the pod and disk are filtered out.

    2. The system tries to create the pod in the specified order. If resources in the first zone are insufficient, the system tries the second zone, and so on, until the pod is created.

  • VSwitchRandom: The system schedules resources at random. Rule details:

    1. If you want to mount a disk to the pod that you are creating, the zone of the disk must be the same as the zone of the pod. The zones that cannot provide both the pod and disk are filtered out.

    2. The system tries the specified vSwitches (corresponding to zones) in a random order.

    3. If you specified specifications for the pod that you are creating, zones that have a reserved instance for the specified pod specifications are preferentially used to create the pod.

    4. Zones that provide higher storage performance are preferentially used to create the pod. The following early zones are less preferentially used to create the pod:

      • cn-beijing-e and cn-beijing-d

      • cn-shenzhen-a, cn-shenzhen-b, and cn-shenzhen-c

      • cn-hangzhou-b, cn-hangzhou-e, and cn-hangzhou-f

      • cn-shanghai-a and cn-shanghai-c

Note

We recommend that you specify multiple zones and specifications to create elastic container instances. You can use the VSwitchId parameter to specify multiple zones and use the InstanceType parameter to specify multiple specifications.

Console mode

When you create an elastic container instance by using the buy page in the Elastic Container Instance console, you can select multiple vSwitches to specify multiple zones.多可用区1

What to do next

If you use a network address translation (NAT) gateway to access the Internet and you configure multiple zones (vSwitches) to create elastic container instances, you must check whether the number of source network address translation (SNAT) entries that you configured for the NAT gateway is sufficient for the number of zones that you configured.

For example, when you create a SNAT entry, you specify a vSwitch for it. If you specify multiple vSwitches when you create an elastic container instance, you must increase SNAT entries for the new vSwitches to ensure that the elastic container instances that are connected to the new vSwitches can access the Internet.

SNAT