When you create pods (elastic container instances) in a Kubernetes cluster, you can add annotations to the pods to use all features of Elastic Container Instance. Make sure that the annotations that you want to add comply with the Kubernetes syntax. This topic describes the annotations that you can add when you create a pod. This topic also describes the annotations that you can add after the system schedules resources and creates pods.
Annotations that you can add when you create pods
The following table describes the annotations that you can add when you create pods.
The annotations described in the following table are applicable only to the pods that are scheduled to VNodes. These pods run as elastic container instances. The annotations cannot be added to the pods that are scheduled to real nodes.
Annotations must be added to the metadata of the configuration file of the pods. For example, when you create a Deployment, you must add annotations in the spec.template.metadata section.
To use features of Elastic Container Instance, you can add annotations only when you create Elastic Container Instance-based pods. If you add or modify annotations when you update pods, these annotations do not take effect.
Annotation | Example | Description | References |
k8s.aliyun.com/eci-security-group | sg-bp1dktddjsg5nktv**** | Specifies the IDs of the security groups. The following requirements must be met:
| |
k8s.aliyun.com/eci-use-specs | 2-4Gi,4-8Gi,ecs.c6.xlarge | Specifies one or more specifications of the pod. The specifications can be a combination of number of vCPUs and memory size. The specifications can also be instance types of Elastic Compute Service (ECS) instances. | |
k8s.aliyun.com/eci-gpu-driver-version | tesla=525.85.12 | Specifies the version of the GPU driver. If you specify a GPU-accelerated ECS instance family that supports multiple versions of GPU drivers and CUDA when you create a GPU-accelerated elastic container instance, you can configure this annotation to specify the version of the driver and CUDA. | |
k8s.aliyun.com/eci-instance-family | "ecs.c6,ecs.g6" | Specifies or excludes specific ECS instance families while you create pods by specifying specifications of vCPU and memory. | |
k8s.aliyun.com/eci-instance-generation | "6,5" | Specifies or excludes specific generations of ECS instance families while you create pods by specifying specifications of vCPU and memory. | Specify or exclude specific generations of ECS instance families to create a pod |
k8s.aliyun.com/eci-spot-strategy | SpotAsPriceGo | Specifies the bidding policy when you create a preemptible instance. Valid values:
| |
k8s.aliyun.com/eci-spot-price-limit | "0.5" | Specifies the maximum hourly price of the preemptible instance. This value can be accurate to three decimal places. This annotation is valid only when k8s.aliyun.com/eci-spot-strategy is set to SpotWithPriceLimit. | |
k8s.aliyun.com/eci-spot-duration | "0" | Specifies the protection period of the preemptible instance. Unit: hour. Default value: 1. A value of 0 indicates no protection period. | |
k8s.aliyun.com/eci-spot-fallback | "true" | Specifies whether to automatically create a pay-as-you-go instance if inventory resources that meet the requirements for the preemptible instance specification are insufficient. Default value: false. | |
k8s.aliyun.com/eci-auto-imc | "true" | Specifies whether to automatically match image caches. | |
k8s.aliyun.com/imc-perfect-match | "true" | Specifies whether all container images in the pod must exactly match the image cache. | |
k8s.aliyun.com/imc-match-count-request | "2" | Specifies the number of container images in the pod that you want to exactly match the image cache. | |
k8s.aliyun.com/eci-imc-id | imc-2zebxkiifuyzzlhl**** | Specifies the ID of the image cache. | |
k8s.aliyun.com/acr-instance-ids | cri-j36zhodptmyq**** | Specifies the IDs of the Container Registry Enterprise Edition instances. You can specify Container Registry Enterprise Edition instances that reside in a region different from the region of the pod. You must prefix the region ID of an Enterprise Edition instance to the ID of the Enterprise Edition instance. Example: | Pull images from a Container Registry instance without using secrets |
k8s.aliyun.com/acr-service-arns | acs:ram::1609982529******:role/role-assume | Specifies the Alibaba Cloud Resource Names (ARNs) of the RAM roles in the Alibaba Cloud account to which the Elastic Container Instance resources belong. This annotation is required when you use a RAM role to create resources. | |
k8s.aliyun.com/acr-user-arns | acs:ram::1298452580******:role/role-acr | Specifies the ARNs of the RAM roles in the Alibaba Cloud account to which the Container Registry instance belongs. This annotation is required when you pull images from a Container Registry instance that belongs to an Alibaba Cloud account different from the Alibaba Cloud account of the Elastic Container Instance resource. | |
k8s.aliyun.com/plain-http-registry | harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80 | Configures the address of the self-managed image repository. When you create a pod by using an image in a self-managed image repository that uses the HTTP protocol, you must add this annotation to the instance. This way, Elastic Container Instance pulls the image over the HTTP protocol instead over the default HTTPS protocol. This prevents image pull failures caused by different protocols. | |
k8s.aliyun.com/insecure-registry | harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80 | Configures the address of the self-managed image repository. When you create a pod by using an image in a self-managed image repository that uses a self-signed certificate, you must add this annotation to the instance to skip the certificate authentication. This prevents image pull failures caused by certificate authentication failures. | |
k8s.aliyun.com/eci-eip-instanceid | eip-bp1q5n8cq4p7f6dzu**** | Specifies the ID of the elastic IP address (EIP). | |
k8s.aliyun.com/eci-with-eip | "true" | Specifies whether to automatically create an EIP when you create an elastic container instance and associate the EIP with the instance. | |
k8s.aliyun.com/eip-bandwidth | "5" | Specifies the bandwidth for the EIP. Unit: Mbits/s. Default value: 5. | |
k8s.aliyun.com/eip-common-bandwidth-package-id | cbwp-2zeukbj916scmj51m**** | Specifies the ID of an existing EIP bandwidth plan that you want to associate with the instance. For more information, see What is an Internet Shared Bandwidth? | |
k8s.aliyun.com/eip-isp | BGP | Specifies the line type for the EIP. This annotation is applicable only to pay-as-you-go EIPs. Valid values:
For more information, see the "Line types" section of the Elastic IP Addresses topic. | |
k8s.aliyun.com/eip-internet-charge-type | PayByBandwidth | Specifies the metering method of the EIP. Valid values:
For more information, see Billing overview. | |
k8s.aliyun.com/eip-public-ip-address-pool-id | pippool-bp187arfugi543y1s**** | Specifies the ID of the IP address pool. The EIP is allocated from the IP address pool. For more information, see Create and manage an IP address pool. | |
k8s.aliyun.com/eci-enable-ipv6 | "true" | Specifies whether to assign an IPv6 address to the pod. | |
k8s.aliyun.com/eci-ipv6-bandwidth-enable | "true" | Specifies whether to enable Internet access to the pod over IPv6 addresses. | |
k8s.aliyun.com/eci-ipv6-bandwidth | 100M | Specifies the maximum public bandwidth of the IPv6 address. | |
kubernetes.io/ingress-bandwidth | 40M | Specifies the inbound bandwidth. | |
kubernetes.io/egress-bandwidth | 20M | Specifies the outbound bandwidth. | |
k8s.aliyun.com/eci-extra-ephemeral-storage | 50Gi | Specifies the size of the temporary storage space. | |
k8s.aliyun.com/eci-eviction-enable | "true" | Specifies whether to automatically evict pods whose size of temporary storage spaces is insufficient. | Automatically evict pods whose size of temporary storage spaces is insufficient |
k8s.aliyun.com/eci-ntp-server | 100.100.*.* | Specifies the IP address of the Network Time Protocol (NTP) server. |
Annotations that you can add after the system schedules resources and creates pods
The following table describes the annotations that you can add after the system schedules resources and creates pods. You can run the kubectl describe
command to query the details of the pods.
Annotation | Example | Description |
k8s.aliyun.com/eci-request-id | 45942504-4688-51BA-BBAB-4B692C4F39C0 | Indicates the request ID. |
k8s.aliyun.com/eci-instance-id | eci-2ze1y0la40qgva09**** | Indicates the pod ID. |
k8s.aliyun.com/eci-instance-spec | 2.0-4.0Gi | Indicates the specifications of the pod. You are charged based on the value.
|
k8s.aliyun.com/allocated-eipInstanceId | eip-bp1q5n8cq4p7f6dzu**** | Indicates the EIP ID. |
k8s.aliyun.com/allocated-eipAddress | 47.99.**.** | Indicates the EIP that is associated with the instance. |
k8s.aliyun.com/allocated-ipv6Address | 2001:d**:1:1:1:1:1:1 | Indicates the IPv6 address that is assigned to the pod. |
k8s.aliyun.com/eci-created-by-template | true | Indicates whether a template was used to create the pod. |
k8s.aliyun.com/eni-instance-id | eni-2ze6d7oo5ukqj26o**** | Indicates the ID of the elastic network interface (ENI) that is bound to the pod. |
k8s.aliyun.com/eci-vpc | vpc-2zeghwzptn5zii0w7**** | Indicates the virtual private cloud (VPC) to which the pod belongs. |
k8s.aliyun.com/eci-matched-image-cache | imc-2zedy3v37800iimu**** | Indicates the ID of the matched image cache. |
k8s.aliyun.com/eci-schedule-result | finished | Indicates the scheduling result. |