All Products
Search
Document Center

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

Last Updated:Apr 01, 2026

When ECI creates a pod, it rounds up the total container resource requests to the nearest supported specification. For pods that include sidecar containers (such as logging agents or monitoring proxies), this rounding can result in an instance larger than your workload needs. Set the __ECI_RESOURCE_IGNORE__ environment variable on those sidecar containers so ECI excludes them from the specification calculation, reducing instance size and cost.

How it works

ECI determines pod specifications by summing the resource limits of all containers in the pod. If the sum does not match a supported specification, ECI rounds it up to the nearest valid combination of vCPUs and memory. The sum of per-container resource limits cannot exceed the specifications of the instance.

资源规整2

The per-container limits you specify are resource upper bounds, not fixed allocations. ECI dynamically adjusts each container's resource allocation when the instance starts.

Example — China (Hangzhou) region, one pod with three containers:

ContainerTypevCPUMemory
Container 1Application24 GiB
Container 2Application24 GiB
Container 3Sidecar0.250.5 GiB
  • Without the environment variable: ECI sums all containers to 4.25 vCPUs and 8.5 GiB, then rounds up to 6 vCPUs and 10 GiB.

  • With __ECI_RESOURCE_IGNORE__ on Container 3: ECI ignores the sidecar and rounds up only the application containers to 4 vCPUs and 8 GiB.

资源规整

Set the environment variable

Add the following environment variable to any container you want ECI to exclude from specification adjustment:

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

Apply this to containers that do not affect your core workload — typically sidecar containers such as log collectors, metrics exporters, or service mesh proxies.

Configure a Deployment to exclude a sidecar container

The following Deployment uses two containers. The nginx1 container drives specification adjustment; nginx2 is excluded.

Note

Without __ECI_RESOURCE_IGNORE__ on nginx2, the combined request is 3 vCPUs and 6 GiB. In the China (Hangzhou) region, ECI rounds this up to 4 vCPUs and 6 GiB. With the variable set, ECI uses only nginx1's limits and creates a pod with 2 vCPUs and 4 GiB.

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