Create pods with multiple instance types
When you create Elastic Container Instance (ECI) pods (that is, ECI instances) at scale, insufficient inventory may occur. In this case, configure multiple instance types. The system then attempts to create a pod by using the configured instance types in sequence, which improves the ECI pod creation success rate.
Background information
If you specify multiple specifications when you create an elastic container instance, the system tries to use the specifications in sequence. This improves the creation success rate.
During the retry, the instance remains in the Pending state.
The multi-specification mode is effective at the instance level and only affects the creation policy of a single instance.
You can also specify multiple zones when you use the multi-specification mode. This further improves the creation success rate.
Instance type overview
vCPU and memory specifications supported by Elastic Container Instance
ECS instance families supported by ECI
Configuration notes
Add the k8s.aliyun.com/eci-use-specs annotation to the pod metadata to specify instance types.
-
When you specify multiple instance types, you can specify vCPU and memory specifications, ECS instance types, or both.
ImportantAfter the pod is created, you can check the
k8s.aliyun.com/eci-instance-specfield in the YAML details of the pod to confirm the instance type that the pod actually uses. If the pod uses an ECS instance type, you are billed based on the ECS instance type. If the pod uses specific vCPU and memory values, you are billed based on vCPUs and memory. -
Configure multiple instance types in the order of priority in which you want to use them. You can specify a maximum of five instance types at a time.
-
Some instance types, such as GPU instance types, instance types with local disks, and Arm instance types, require additional parameters besides the instance type itself. When you specify multiple instance types of this kind, you can specify only instance types of the same type.
The following example shows the configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx-test
labels:
app: nginx
alibabacloud.com/eci: "true"
annotations:
k8s.aliyun.com/eci-use-specs: 2-4Gi,ecs.c5.large,ecs.c6.large #As needed, replace with the instance types that you want to use
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80