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
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 view the YAML file details of the pod and check the specifications that are actually used by the pod in the
k8s.aliyun.com/eci-instance-spec
field. 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. Up to five specifications can be specified.
If you specify GPU-accelerated ECS instance types, ECS instance types that use local disks, or ARM-based ECS instance types when you create a pod, you must configure additional parameters. Therefore, you cannot specify one of the preceding ECS instance types together with other specifications to create a pod.
Sample 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 # Enter the specifications based on your requirements.
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80