When you don't have specific requirements for vGPUs or local disks, specify vCPU count and memory size instead of an Elastic Compute Service (ECS) instance type. ECI automatically selects a matching instance type from multiple candidates, giving you better elasticity and resource availability than locking in a specific instance type.
How it works
Set the vCPU and memory you need — either at the container level (using
limitsorrequests) or at the pod level (using thek8s.aliyun.com/eci-use-specsannotation).ECI maps your request to a supported specification. If your values don't match a supported combination exactly, the system rounds up to the nearest supported spec.
The pod is created using the resolved specification. Billing is based on that resolved spec.
Example: If you request 7 vCPUs and 13 GiB in the China (Hangzhou) region, ECI creates an instance with 8 vCPUs and 14 GiB.
Supported specifications
The system rounds up your requested vCPU and memory values to the nearest supported combination. If the rounded-up specification differs from what you requested, billing is based on the adjusted specification.
If you don't specify vCPUs or memory, ECI creates the pod with 2 vCPUs and 4 GiB by default.
Each elastic container instance supports only one elastic network interface (ENI).
All specifications include 30 GiB of temporary storage by default.
Specifications available in all regions
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 0.25 | 0.5, 1 | 0.08 |
| 0.5 | 1, 2 | 0.08 |
| 1 | 2, 4, 8 | 0.1 |
| 2 | 1, 2, 4, 8, 16 | 1 |
| 4 | 2, 4, 8, 16, 32 | 1.5 |
| 8 | 4, 8, 16, 32, 64 | 2 |
| 12 | 12, 24, 48, 96 | 2.5 |
| 16 | 16, 32, 64, 128 | 3 |
| 24 | 24, 48, 96, 192 | 4.5 |
| 32 | 32, 64, 128, 256 | 6 |
| 52 | 96, 192, 384 | 12.5 |
| 64 | 128, 256, 512 | 20 |
Specifications available in selected regions only
These specifications are only available in: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Chengdu), and Singapore. If the region or zone you specify doesn't have available resources for these specs, the pod cannot be created.
These specifications cannot be used to create preemptible instances.
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 2 | 6, 10, 12, 14 | 1 |
| 4 | 6, 10, 12, 14, 18, 20, 22, 24, 26, 28, 30 | 1.5 |
| 6 | 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, and 48 | 1.5 |
| 8 | 10, 12, 14, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62 | 2.5 |
Configuration methods
Use one of the following methods to define pod resources. When both container-level parameters and the pod-level annotation are present, the annotation takes precedence.
| Scenario | Pod specification used |
|---|---|
None of limits, requests, or eci-use-specs specified | 2 vCPUs and 4 GiB (default) |
Only limits specified | Sum of limits across all containers |
Only requests specified | Sum of requests across all containers |
Both limits and requests specified | Sum of limits across all containers (requests is ignored) |
Only eci-use-specs specified | Value of eci-use-specs |
limits + eci-use-specs, or requests + eci-use-specs | Value of eci-use-specs |
Set resources at the container level
This is the standard Kubernetes approach. Specify limits or requests for each container in the pod. ECI sums the values across all containers to determine the pod specification.
Use limits rather than requests when possible — when both are present, ECI uses limits and ignores requests.
To prevent a sidecar container from counting toward the pod's resource total, set an environment variable on it to have ECI ignore it during resource adjustment. For more information, see Ignore specific containers when the system adjusts resources.
The following example uses limits to set vCPU and memory for each container:
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: test
labels:
app: nginx
alibabacloud.com/eci: "true"
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80
resources:
limits:
cpu: "500m" # 0.5 vCPU for the nginx container
memory: "1024Mi" # 1 GiB for the nginx container
- name: busybox
image: registry.cn-shanghai.aliyuncs.com/eci_open/busybox:1.30
command: ["sleep"]
args: ["999999"]
resources:
limits:
cpu: "1000m" # 1 vCPU for the busybox container
memory: "2048Mi" # 2 GiB for the busybox containerIf the sum of resource values across all containers is not supported by ECI, the system adjusts the pod specification and charges you based on the adjusted specification.
Each pod supports up to 20 containers. The combined resource usage of all containers must not exceed the pod-level specification.
Set resources at the pod level
Add the k8s.aliyun.com/eci-use-specs annotation to the pod metadata to define resources for the entire pod at once. ECI then selects from multiple compatible instance types to maximize elasticity.
This approach is useful when:
Containers in the pod share resources without fixed individual allocations.
Your workload runs in frameworks that inject sidecar containers automatically, such as genomic computing pipelines or Istio service meshes.
To restrict which ECS instance families ECI selects from — for example, to require sixth-generation instance families — add an instance family annotation. For more information, see Specify generations of ECS instance families to create pods.
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: test
labels:
app: nginx
alibabacloud.com/eci: "true"
annotations:
k8s.aliyun.com/eci-use-specs: "2-4Gi" # 2 vCPUs and 4 GiB for the pod
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80
- name: busybox
image: registry.cn-shanghai.aliyuncs.com/eci_open/busybox:1.30
command: ["sleep"]
args: ["999999"]
resources:
limits:
cpu: "500m" # Maximum vCPU for this container
memory: "1024Mi" # Maximum memory for this containerThe eci-use-specs value uses the format {vCPU}-{memory}. For example, 2-4Gi requests 2 vCPUs and 4 GiB of memory. When eci-use-specs is set, container-level limits and requests values are ignored for pod sizing but still apply as in-container resource constraints.