Pod annotations configure Elastic Container Instance (ECI) features when scheduling pods to virtual nodes in a Kubernetes cluster. Add them to the pod's metadata section at creation time—annotations added or modified during pod updates are ignored.
Annotations only take effect on pods scheduled to virtual nodes, not pods scheduled to real nodes. For Deployments, add annotations in spec.template.metadata, not the top-level metadata.
Annotations added at pod creation
Preemptible instances
Use preemptible instances to reduce compute costs. Two bid policies are available: SpotAsPriceGo uses the market price at purchase time; SpotWithPriceLimit lets you set a maximum hourly price.
metadata:
annotations:
# Bid policy. Valid values:
# SpotAsPriceGo – market price at purchase time (recommended for simplicity)
# SpotWithPriceLimit – your specified maximum hourly price; requires eci-spot-price-limit
k8s.aliyun.com/eci-spot-strategy: "SpotAsPriceGo"
# Maximum hourly price, accurate to 3 decimal places.
# Required when eci-spot-strategy is SpotWithPriceLimit; ignored otherwise.
k8s.aliyun.com/eci-spot-price-limit: "0.500"
# Protection period in hours. Default: 1. Set to 0 to disable protection.
k8s.aliyun.com/eci-spot-duration: "1"
# Fall back to a pay-as-you-go instance if preemptible inventory is insufficient.
# Default: false
k8s.aliyun.com/eci-spot-fallback: "true"
| Annotation | Default | Description |
|---|---|---|
k8s.aliyun.com/eci-spot-strategy |
— | Bid policy. SpotAsPriceGo uses the market price. SpotWithPriceLimit requires eci-spot-price-limit. |
k8s.aliyun.com/eci-spot-price-limit |
— | Maximum hourly price (up to 3 decimal places). Valid only when eci-spot-strategy is SpotWithPriceLimit. |
k8s.aliyun.com/eci-spot-duration |
1 |
Protection period in hours. 0 disables the protection period. |
k8s.aliyun.com/eci-spot-fallback |
false |
When true, ECI creates a pay-as-you-go instance if preemptible inventory is insufficient. |
For more information, see Create a preemptible elastic container instance.
Pulling images from Container Registry
To pull images from a Container Registry Enterprise Edition instance without configuring a secret, specify the instance ID and the required RAM role ARNs.
metadata:
annotations:
# Container Registry Enterprise Edition instance ID.
# For cross-region pulls, prefix the region ID: "cn-beijing:cri-j36zhodptmyq****"
k8s.aliyun.com/acr-instance-ids: "cri-j36zhodptmyq****"
# ARN of the RAM role in the account that owns the ECI resources.
# Required when creating resources with a RAM role.
k8s.aliyun.com/acr-service-arns: "acs:ram::1609982529******:role/role-assume"
# ARN of the RAM role in the account that owns the Container Registry instance.
# Required only when the Container Registry instance belongs to a different Alibaba Cloud account.
k8s.aliyun.com/acr-user-arns: "acs:ram::1298452580******:role/role-acr"
| Annotation | Description |
|---|---|
k8s.aliyun.com/acr-instance-ids |
Container Registry Enterprise Edition instance ID. For cross-region pulls, prefix the region ID: "cn-beijing:cri-j36zhodptmyq****". |
k8s.aliyun.com/acr-service-arns |
ARN of the RAM role in the account that owns the ECI resources. Required when using a RAM role. |
k8s.aliyun.com/acr-user-arns |
ARN of the RAM role in the account that owns the Container Registry instance. Required when pulling from a different Alibaba Cloud account. |
For more information, see Pull images from a Container Registry instance without using a secret.
Pulling images from a self-managed repository
For images hosted in a self-managed repository, configure the registry address based on how it handles connections.
metadata:
annotations:
# HTTP registry: ECI pulls over HTTP instead of the default HTTPS.
# Prevents pull failures caused by protocol mismatch.
k8s.aliyun.com/plain-http-registry: "harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"
# Self-signed certificate registry: ECI skips certificate verification.
# Prevents pull failures caused by certificate validation errors.
k8s.aliyun.com/insecure-registry: "harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"
| Annotation | Description |
|---|---|
k8s.aliyun.com/plain-http-registry |
Registry address for repositories using plain HTTP. ECI pulls the image over HTTP instead of the default HTTPS. |
k8s.aliyun.com/insecure-registry |
Registry address for repositories with a self-signed certificate. ECI skips certificate verification. |
For more information, see Pull an image from a self-managed image repository.
Security groups
metadata:
annotations:
# One or more security group IDs, separated by commas.
# Limits: max 5 groups; all groups must belong to the same VPC and be the same type.
k8s.aliyun.com/eci-security-group: "sg-bp1dktddjsg5nktv****"
| Annotation | Constraints | Description |
|---|---|---|
k8s.aliyun.com/eci-security-group |
Max 5 groups; same VPC; same type | Security group IDs to assign to the pod. |
For more information, see Assign security groups.
Elastic IP addresses
Assign a static public IP address to a pod using an existing Elastic IP Address (EIP) or let ECI create one automatically.
metadata:
annotations:
# Option 1: Use an existing EIP by ID.
k8s.aliyun.com/eci-eip-instanceid: "eip-bp1q5n8cq4p7f6dzu****"
# Option 2: Let ECI create and associate an EIP automatically.
k8s.aliyun.com/eci-with-eip: "true"
# EIP bandwidth cap in Mbit/s. Default: 5.
k8s.aliyun.com/eip-bandwidth: "5"
# Associate the EIP with an existing EIP bandwidth plan.
k8s.aliyun.com/eip-common-bandwidth-package-id: "cbwp-2zeukbj916scmj51m****"
# EIP line type. Valid values: BGP (BGP Multi-ISP), BGP_PRO (BGP Multi-ISP Pro)
# Applies only to pay-as-you-go EIPs.
k8s.aliyun.com/eip-isp: "BGP"
# EIP metering method. Valid values: PayByBandwidth, PayByTraffic
k8s.aliyun.com/eip-internet-charge-type: "PayByBandwidth"
# Allocate the EIP from a specific IP address pool.
k8s.aliyun.com/eip-public-ip-address-pool-id: "pippool-bp187arfugi543y1s****"
| Annotation | Default | Description |
|---|---|---|
k8s.aliyun.com/eci-eip-instanceid |
— | ID of an existing EIP to associate with the pod. |
k8s.aliyun.com/eci-with-eip |
— | When true, ECI creates and associates an EIP automatically. |
k8s.aliyun.com/eip-bandwidth |
5 |
EIP bandwidth cap in Mbit/s. |
k8s.aliyun.com/eip-common-bandwidth-package-id |
— | ID of an existing EIP bandwidth plan. For more information, see What is an Internet Shared Bandwidth? |
k8s.aliyun.com/eip-isp |
— | Line type for pay-as-you-go EIPs. Valid values: BGP (BGP Multi-ISP), BGP_PRO (BGP Multi-ISP Pro). See the "Line type" section in What is an EIP. |
k8s.aliyun.com/eip-internet-charge-type |
— | EIP metering method. Valid values: PayByBandwidth, PayByTraffic. See Billing overview. |
k8s.aliyun.com/eip-public-ip-address-pool-id |
— | ID of the IP address pool from which to allocate the EIP. See Create and manage IP address pools. |
For more information, see Associate an EIP with an elastic container instance.
IPv6
metadata:
annotations:
# Assign an IPv6 address to the pod.
k8s.aliyun.com/eci-enable-ipv6: "true"
# Enable Internet access over the IPv6 address.
k8s.aliyun.com/eci-ipv6-bandwidth-enable: "true"
# Peak public bandwidth for the IPv6 address (e.g., "100M").
k8s.aliyun.com/eci-ipv6-bandwidth: "100M"
| Annotation | Description |
|---|---|
k8s.aliyun.com/eci-enable-ipv6 |
Assign an IPv6 address to the pod. |
k8s.aliyun.com/eci-ipv6-bandwidth-enable |
Enable Internet access over the IPv6 address. |
k8s.aliyun.com/eci-ipv6-bandwidth |
Peak public bandwidth of the IPv6 address. |
For more information, see Assign an IPv6 address to an Elastic Container Instance-based pod.
Bandwidth limits
Limit inbound and outbound bandwidth at the pod level.
metadata:
annotations:
kubernetes.io/ingress-bandwidth: "40M"
kubernetes.io/egress-bandwidth: "20M"
| Annotation | Description |
|---|---|
kubernetes.io/ingress-bandwidth |
Maximum inbound bandwidth. |
kubernetes.io/egress-bandwidth |
Maximum outbound bandwidth. |
For more information, see Limit the inbound and outbound bandwidth of pods.
NTP server
metadata:
annotations:
# IP address of the Network Time Protocol (NTP) server.
k8s.aliyun.com/eci-ntp-server: "100.100.*.*"
| Annotation | Description |
|---|---|
k8s.aliyun.com/eci-ntp-server |
IP address of the Network Time Protocol (NTP) server to use in the pod. |
For more information, see Configure the NTP service.
Annotations written by the system after pod scheduling
After ECI schedules and creates a pod, the system writes the following read-only annotations back to the pod. Run kubectl describe pod <pod-name> to view them.
Name: my-pod
Namespace: default
Annotations: k8s.aliyun.com/eci-instance-id: eci-2ze1y0la40qgva09****
k8s.aliyun.com/eci-instance-spec: 2.0-4.0Gi
k8s.aliyun.com/eci-instance-compute-category: economy
k8s.aliyun.com/eci-request-id: 45942504-4688-51BA-BBAB-4B692C4F39C0
k8s.aliyun.com/allocated-eipInstanceId: eip-bp1q5n8cq4p7f6dzu****
k8s.aliyun.com/allocated-eipAddress: 47.99.**.**
k8s.aliyun.com/allocated-ipv6Address: 2001:d**:1:1:1:1:1:1
k8s.aliyun.com/eni-instance-id: eni-2ze6d7oo5ukqj26o****
k8s.aliyun.com/eci-vpc: vpc-2zeghwzptn5zii0w7****
k8s.aliyun.com/eci-matched-image-cache: imc-2zedy3v37800iimu****
k8s.aliyun.com/eci-created-by-template: true
| Annotation | Example | Description |
|---|---|---|
k8s.aliyun.com/eci-request-id |
45942504-4688-51BA-BBAB-4B692C4F39C0 |
Request ID for the pod creation call. |
k8s.aliyun.com/eci-instance-id |
eci-2ze1y0la40qgva09**** |
Pod ID in ECI. |
k8s.aliyun.com/eci-instance-spec |
2.0-4.0Gi |
Actual pod spec used for billing. A vCPU-memory value (e.g., 2.0-4.0Gi) means billing is based on vCPU and memory. An ECS instance type (e.g., ecs.c6.large) means billing is based on that instance type. |
k8s.aliyun.com/eci-instance-compute-category |
economy |
Compute category of the underlying instance. economy applies economy compute category billing; general applies general compute category billing. |
k8s.aliyun.com/allocated-eipInstanceId |
eip-bp1q5n8cq4p7f6dzu**** |
ID of the EIP associated with the pod. |
k8s.aliyun.com/allocated-eipAddress |
47.99.. |
EIP address associated with the pod. |
k8s.aliyun.com/allocated-ipv6Address |
2001:d**:1:1:1:1:1:1 |
IPv6 address assigned to the pod. |
k8s.aliyun.com/eci-created-by-template |
true |
Indicates whether the pod was created from a template. |
k8s.aliyun.com/eni-instance-id |
eni-2ze6d7oo5ukqj26o**** |
ID of the elastic network interface (ENI) bound to the pod. |
k8s.aliyun.com/eci-vpc |
vpc-2zeghwzptn5zii0w7**** |
ID of the virtual private cloud (VPC) the pod belongs to. |
k8s.aliyun.com/eci-matched-image-cache |
imc-2zedy3v37800iimu**** |
ID of the image cache matched during pod creation. |
k8s.aliyun.com/eci-schedule-result |
finished |
Retired. For pod scheduling results, check the ContainerInstanceCreated condition instead. |