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:
Summing the resource limits of all containers in the pod.
Rounding up to the nearest supported ECI specification if the sum does not match one exactly.
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.

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

| Container | Type | vCPU | Memory |
|---|---|---|---|
| Container 1 | Application | 2 | 4 GiB |
| Container 2 | Application | 2 | 4 GiB |
| Container 3 | Sidecar | 0.25 | 0.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__onnginx2, 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, onlynginx1'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