All Products
Search
Document Center

Container Compute Service:Pod annotations

Last Updated:May 14, 2025

When you create pods in an Alibaba Cloud Container Compute Service (ACS) cluster, you can add annotations to the pods to enable and configure some extended features. This topic describes the annotations that you can add to pods in ACS clusters.

Annotations that you can add when you create an ACS pod

You can configure the supported keys and values in pod annotation to enable related features and configurations. Example:

Pod configuration example

apiVersion: v1
kind: Pod
metadata:
  name: annotation-pod
  annotations:
    network.alibabacloud.com/vswitch-ids: "vsw-foo"
spec:
  ...

Deployment configuration example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: foo
  ...
spec:
  ...
  template:
    metadata:
      annotations:
        network.alibabacloud.com/vswitch-ids: "vsw-foo"
    ...

Network

Feature

Parameter

Example

Description

Specify vSwitches and security groups for pods

network.alibabacloud.com/vswitch-ids

"vsw-slw1***,vsw-lkjwo***"

Specifies the ID of the vSwitch. You can specify multiple vSwitches to create pods in multiple zones.

Important

When vSwitches and affinity rules are both specified for a pod, ACS preferably creates resources based on the vSwitches. The affinity rules are ignored.

Important

If a Pod uses a PVC of the WaitForFirstConsumer type, you must specify the corresponding zone in the affinity setting of the pod. The scheduler ensures that the zone of the PVC is the same as that of the vSwitch in case the pod becomes pending. For more information, see Node affinity scheduling.

network.alibabacloud.com/security-group-ids

"sg-sljwo***,sg-lwirp***"

Specifies the ID of the security group. You can specify multiple security groups.

Add annotations to configure a custom DNS server

network.alibabacloud.com/custom-dnsconfig

{"servers":["20.1.xx.xx","30.1.xx.xx"],"searches":["xx.com","yy.com"],"options":["ndots:2","edns0"]}

Specifies a custom DNS server configuration.

Use network policies in ACS clusters

alibabacloud.com/enable-network-policy-agent

"true"

Enable the network policy for ACS pods. The default value is false.

Mount an independent EIP for pods

network.alibabacloud.com/pod-with-eip

"true"

Specifies whether to automatically create an Elastic IP Address (EIP) and associate the EIP with a pod. Valid values:

  • true: automatically creates an EIP and associates the EIP with a pod.

  • false: does not automatically create an EIP or associate the EIP with a pod.

network.alibabacloud.com/pod-eip-instanceid

"eip-bp14q***"

Specifies the ID of the EIP that you want to use, such as eip-bp14q***. For more information, see Apply for EIPs.

k8s.aliyun.com/eci-eip-instanceid (compatible with Elastic Container Instance)

network.alibabacloud.com/eip-bandwidth

"5"

Specifies the maximum bandwidth of the EIP. Unit: Mbit/s.

network.alibabacloud.com/eip-internet-charge-type

"PayByTraffic"

Specifies the metering method of the EIP. Valid values:

  • paybytraffic (default): pay-by-data-transfer.

  • PayByBandwidth: pay-by-bandwidth.

For more information about the billing of EIPs, see Billing overview.

k8s.aliyun.com/eip-charge-type (compatible with earlier versions)

network.alibabacloud.com/eip-instance-charge-type

"PrePaid"

Specifies the billing method of the EIP. Valid values:

  • PrePaid: subscription.

  • PostPaid: pay-as-you-go.

For more information, see Subscription and Pay-as-you-go.

network.alibabacloud.com/eip-common-bandwidth-package-id

"cbwp-slex***"

Specifies the Internet Shared Bandwidth instance that you want to use.

network.alibabacloud.com/eip-isp

"BGP"

Specifies the line type of the EIP. Valid values:

  • BGP: BGP (Multi-ISP) lines.

  • BGP_PRO: BGP (Multi-ISP) Pro lines.

For more information, see Apply for EIPs.

network.alibabacloud.com/eip-public-ip-address-pool-id

"pippool-dlsw***"

Specifies the IP address pool. For more information, see Create and manage an IP address pool.

network.alibabacloud.com/eip-resource-group-id

Specifies the resource group to which the EIP resides. For more information, see Apply for EIPs.

network.alibabacloud.com/eip-name

Specifies the name of the EIP. For more information, see Apply for EIPs.

network.alibabacloud.com/eip-description

Specifies the description of the EIP. For more information, see Apply for EIPs.

network.alibabacloud.com/eip-security-protection-types

Specifies the security services used to protect the EIP. Separate multiple security services with commas (,). For more information, see Apply for EIPs

network.alibabacloud.com/pod-eip-release-strategy

"Never"

Specifies the EIP release policy. Valid values:

  • Follow (default value): follows the lifecycle of the pod that is associated with the EIP.

  • Never: does not release the EIP. You need to manually release the EIP that is associated with the pod if you no longer require the EIP.

  • Set the expiration time of the EIP. For example, 5m30s indicates that the EIP is released 5 minutes and 30 seconds after the pod is deleted. Time expressions written in Go are supported.

Image

Feature

Parameter

Example

Description

Pull an image from a self-managed image repository

registry.alibabacloud.com/plain-http-registry

"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"

When you pull an image from a self-managed image repository that uses the HTTP protocol, you must specify this parameter. This prevents image pull failures due to different protocols.

registry.alibabacloud.com/insecure-registry

"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"

When you pull an image from a self-managed image repository that uses a self-signed certificate, you must specify this parameter to skip certificate authentication. This prevents image pull failures arising from certificate authentication failures.

Scheduling

Feature

Parameter

Example

Description

Pod QoS-based rescheduling policy

alpha.alibabacloud.com/compute-qos-strategy

"best-effort-to-default"

Specify the compute-qos rescheduling policy. Set the value to best-effort-to-default to prioritize BestEffort pods. When BestEffort pods are insufficient, default pods are deployed.

Important

You do not need to add the alibabacloud.com/compute-qos label when using this annotation. If this label is already added, the label value shall prevail.

Annotations that automatically added by ACS

Note

The following annotation information is the result generated after the processing of ACS-related functions, such as the allocation results of elastic network interface (ENI) and EIP. You cannot set or modify these annotations.

Feature

Parameter

Example

Description

ENI allocation information

network.alibabacloud.com/allocated-eni-id

"eni-esdxs***"

Indicates the ID of the assigned ENI.

network.alibabacloud.com/vpc-id

"vpc-sljwo***"

Indicates the ID of the virtual private cloud (VPC) to which the ENI resides.

network.alibabacloud.com/vswitch-id

"vsw-lskdw***"

Indicates the ID of the vSwitch to which the ENI resides. If you specify multiple vSwitches when you create an ACS pod, the vSwitch that is used is displayed.

EIP allocation information

network.alibabacloud.com/allocated-eip-id

"eip-bp1m***"

Indicates the ID of the assigned EIP.

network.alibabacloud.com/allocated-eip-address

"116.62.***"

Indicates the IP address of the assigned EIP.

Resource specifications

alibabacloud.com/pod-use-spec

"2.5-5Gi"

Indicates the CPU and memory specifications of the ACS pod. The specifications are in the xxvCPU-xxGiB format.

alibabacloud.com/pod-gpu-use-spec

"1"

Indicates the number of GPUs in the ACS pod after the specification is adjusted.

alibabacloud.com/pod-ephemeral-storage

"30Gi"

Indicates the size of the temporary storage space of the ACS pod after the specification is adjusted. Unit: GiB.

Scheduling results

topology.kubernetes.io/region

"cn-hangzhou"

Indicates the region to which the ACS pod resides.

topology.kubernetes.io/zone

"cn-hangzhou-i"

Indicates the zone to which the ACS pod resides.

Other metadata information

alibabacloud.com/instance-id

"acs-sdsf***"

Indicates the instance ID of the ACS pod.

alibabacloud.com/request-id

"6925D4B7-***"

Indicates the request ID.