All Products
Search
Document Center

Elastic Container Instance:Ignore specific containers when the system adjusts resource specifications

Last Updated:Sep 21, 2026

When ECI automatically rounds up pod resource specifications to the nearest supported configuration, sidecar containers can push the total past a threshold and trigger a larger rounding step. Set the __ECI_RESOURCE_IGNORE__ environment variable on those containers to exclude them from the rounding calculation and reduce pod costs.

How it works

When you create a pod without specifying instance-level vCPU and memory, ECI calculates the pod size by:

  1. Summing the resource limits of all containers in the pod.

  2. Rounding up to the nearest supported ECI specification if the sum does not match one exactly.

  3. Using the rounded-up specification as the actual pod size and the basis for billing.

If you do specify instance-level vCPU and memory, the sum of all container resource limits cannot exceed the instance-level specification.

Because sidecar containers — such as log collectors, monitoring agents, or service mesh proxies — are typically small relative to application containers, they can push the total past a threshold and trigger a larger rounding step. Setting __ECI_RESOURCE_IGNORE__ on a sidecar container removes it from step 1, so ECI sizes the pod based only on your application containers.

资源规整2

Example — Consider a pod in the China (Hangzhou) region with three containers:

资源规整
ContainerTypevCPUMemory
Container 1Application24 GiB
Container 2Application24 GiB
Container 3Sidecar0.250.5 GiB
  • Without the environment variable: total is 4.25 vCPU + 8.5 GiB, which rounds up to 6 vCPU, 10 GiB.

  • With __ECI_RESOURCE_IGNORE__ on Container 3: total is 4 vCPU + 8 GiB, which rounds up to 4 vCPU, 8 GiB.

Set containers to ignore

Add the following environment variable to each container you want ECI to exclude from resource adjustment:

env:
- name: "__ECI_RESOURCE_IGNORE__"
  value: "TRUE"

Example

The following Deployment creates two replicas. Each pod has two containers: nginx1 (application) and nginx2 (sidecar). ECI sizes the pod based on nginx1's limits only.

Without __ECI_RESOURCE_IGNORE__ on nginx2, the combined limits are 3 vCPU + 6 GiB. In the China (Hangzhou) region, ECI rounds this up to 4 vCPU + 6 GiB. With the variable set, only nginx1's limits (2 vCPU + 4 GiB) are used.
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"
    spec:
      containers:
      - name: nginx1
        image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
        resources:
          limits:
            cpu: "2000m"
            memory: "4096Mi"
      - name: nginx2
        image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
        resources:
          limits:
            cpu: "1000m"
            memory: "2048Mi"
        env:
        - name: "__ECI_RESOURCE_IGNORE__"
          value: "TRUE"
      restartPolicy: Always