When you create a large number of elastic container instances (pods), the resources that you can use may be insufficient. In this case, we recommend that you specify multiple specifications. The system tries to create the pods based on the sequence of the specified specifications. This improves the 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.
Supported specifications
When you specify multiple specifications, you can specify vCPU and memory specifications or Elastic Compute Service (ECS) instance types. You can also specify both of them.
vCPU and memory specifications supported by Elastic Container Instance
ECS instance families supported by Elastic Container Instance
Configuration description
You can add the k8s.aliyun.com/eci-use-specs
annotation to the metadata of the configuration file of a pod to specify specifications for the instance.
When you specify multiple specifications, you can specify vCPU and memory specifications or ECS instance types. You can also specify both of them.
ImportantAfter the pod is created, you can check the specifications that are actually used by the pod in the
k8s.aliyun.com/eci-instance-spec
field in the YAML file of the pod. If the pod uses an ECS instance type, you are charged based on the ECS instance type. If the pod uses vCPU and memory specifications, you are charged based on the number of vCPUs and memory size.You must specify specifications in a priority order. A maximum of five specifications can be specified.
If you want to create GPU-accelerated elastic container instances, elastic container instances that use local disks, or Arm-based elastic container instances, you can only specify corresponding specifications. The specifications that do not support the preceding features cannot be specified.
The following code provides sample configurations:
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 # Sets the specifications that you want to use to create the pod. Replace the value by using the actual specifications.
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80