Elastic Container Instance (ECI) lets you run pods on fully managed, serverless infrastructure in ACK Serverless clusters — no node management required. This page covers the compute specifications ECI supports and how to choose the right creation method for your workload.
How it works
When you create an ECI pod, specify compute resources using the k8s.aliyun.com/eci-use-specs annotation. ECI selects a matching instance and runs your pod on it. After the pod starts, check the k8s.aliyun.com/eci-instance-spec field in the YAML file of the pod to see which specification was actually used — this determines your billing.
-
If ECI uses an ECS instance type, you are billed based on that instance type.
-
If ECI uses vCPU and memory specs, you are billed based on the vCPU count and memory size.
Limitations
Before creating ECI pods, review these constraints:
-
GPU, local disk, and Arm: If your pod requires GPU acceleration, local disks, or Arm architecture, specify only the corresponding instance types. Mixing these with non-matching specs is not supported.
-
Preemptible instances: Certain vCPU/memory specifications (available only in some regions) cannot be used to create preemptible instances.
-
Architecture: ECI defaults to the x86 architecture. For Arm-based pods, see Schedule pods to an Arm-based virtual node.
-
Annotation placement: Add
k8s.aliyun.com/eci-use-specstometadatain the pod spec. In a Deployment, add it tospec.template.metadata.
Specify compute resources using k8s.aliyun.com/eci-use-specs
Use this annotation to declare the compute resources your pod needs. ECI attempts each specification in priority order (first to last) until the pod is created successfully.
| Annotation key | Required | Value format | Notes |
|---|---|---|---|
k8s.aliyun.com/eci-use-specs |
Yes | Comma-separated list of specs | Up to 5 specs. Specify vCPU/memory (e.g., 2-4Gi), ECS instance types (e.g., ecs.c6.large), or a mix of both. |
Example 1: Specify GPU instance types
Use GPU instance types and set the nvidia.com/gpu resource limit per container. GPUs are shared across containers in the pod.
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: "ecs.gn6i-c4g1.xlarge,ecs.gn6i-c8g1.2xlarge" # Specify a maximum of five GPU-accelerated ECS instance types at a time.
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
resources:
limits:
nvidia.com/gpu: "1" # The number of GPUs required by the Nginx container. The GPUs are shared.
ports:
- containerPort: 80
- name: busybox
image: registry.cn-shanghai.aliyuncs.com/eci_open/busybox:1.30
command: ["sleep"]
args: ["999999"]
resources:
limits:
nvidia.com/gpu: "1" # The number of GPUs required by the BusyBox container. The GPUs are shared.
Example 2: Mix vCPU/memory specs and ECS instance types
List specs in priority order. ECI tries them left to right until one succeeds.
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
Verify the spec used
After the pod starts, check the k8s.aliyun.com/eci-instance-spec field in the YAML file of the pod to confirm which specification ECI actually allocated and verify your billing basis.
Supported compute specifications
vCPU and memory specifications
Available in all regions
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 0.25 | 0.5 and 1 | 0.08 |
| 0.5 | 1 and 2 | 0.08 |
| 1 | 2, 4, and 8 | 0.1 |
| 2 | 1, 2, 4, 8, and 16 | 1 |
| 4 | 2, 4, 8, 16, and 32 | 1.5 |
| 8 | 4, 8, 16, 32, and 64 | 2 |
| 12 | 12, 24, 48, and 96 | 2.5 |
| 16 | 16, 32, 64, and 128 | 3 |
| 24 | 24, 48, 96, and 192 | 4.5 |
| 32 | 32, 64, 128, and 256 | 6 |
| 52 | 96, 192, and 384 | 12.5 |
| 64 | 128, 256, and 512 | 20 |
Available in some regions only
These specs cannot be used for preemptible instances. Supported regions: 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 spec is not available in the selected region and zone, the pod cannot be created.
| vCPU | Memory (GiB) | Bandwidth (bidirectional, Gbit/s, theoretical upper limit) |
|---|---|---|
| 2 | 6, 10, 12, and 14 | 1 |
| 4 | 6, 10, 12, 14, 18, 20, 22, 24, 26, 28, and 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, and 62 | 2.5 |
ECS instance families
Choose a creation method
ECI supports three creation methods. Choose based on your resource and billing requirements.
| Creation method | Billing basis | Use when |
|---|---|---|
| Specify vCPU and memory size | vCPU + memory specs | You want flexible resource sizing and pay based on what you request. If you specify unsupported vCPU/memory combinations, the system adjusts the specifications and charges you based on the new specifications. |
| Specify an ECS instance type | ECS instance type | You need specific hardware capabilities, such as GPU acceleration or local disks |
| Specify ECS instance families or generations as filters (with vCPU/memory) | Actual ECS instance type selected by ECI | You want vCPU/memory flexibility but need to constrain which instance families ECI selects |
For detailed steps for each method, see:
Reduce costs
Preemptible instances
Preemptible instances can reduce costs significantly for stateless and fault-tolerant workloads. See Create a preemptible elastic container instance.
Reserved instances and savings plans
For long-running stable workloads, offset your ECI bills with reserved instances or savings plans:
-
vCPU/memory-billed pods: Use general-purpose savings plans.
-
ECS instance type-billed pods: Use general-purpose savings plans, ECS compute savings plans, or reserved instances.
See Use reserved instances and Use savings plans.
Handle insufficient resources
ECI draws from regional cloud resource pools. When creating many pods, some regions or zones may run low on resources. To improve pod creation success rate, specify multiple specs and multiple vSwitches across different zones: