When creating pods in an Alibaba Cloud Container Compute Service (ACS) cluster, add annotations to enable and configure extended features. This reference lists all supported annotation keys, valid values, and their defaults.
How to apply annotations
All annotations go in metadata.annotations. For a Deployment, place them in spec.template.metadata.annotations, not the top-level metadata.
Pod
apiVersion: v1
kind: Pod
metadata:
name: annotation-pod
annotations:
network.alibabacloud.com/vswitch-ids: "vsw-foo"
spec:
containers:
- name: my-container
image: nginx
Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: foo
spec:
selector:
matchLabels:
app: foo
template:
metadata:
annotations:
network.alibabacloud.com/vswitch-ids: "vsw-foo"
spec:
containers:
- name: my-container
image: nginx
Network annotations
| Feature | Annotation | Example | Description |
|---|---|---|---|
| Specify vSwitches and security groups for pods | network.alibabacloud.com/vswitch-ids |
"vsw-slw1*,vsw-lkjwo*" |
The ID of the vSwitch to use. Specify multiple vSwitch IDs (comma-separated) to create pods across zones. |
network.alibabacloud.com/security-group-ids |
"sg-sljwo*,sg-lwirp*" |
The ID of the security group. Specify multiple security group IDs (comma-separated). | |
| Configure a custom DNS server for a pod | network.alibabacloud.com/custom-dnsconfig |
{"servers":["20.1.xx.xx","30.1.xx.xx"],"searches":["xx.com","yy.com"],"options":["ndots:2","edns0"]} |
Custom DNS server configuration. |
| Use network policies in ACS clusters | alibabacloud.com/enable-network-policy-agent |
"true" |
Enable network policies for the pod. Default: false. |
| Mount an elastic IP address for pods | network.alibabacloud.com/pod-with-eip |
"true" |
Automatically create an elastic IP address (EIP) and associate it with the pod. Valid values: true, false. |
network.alibabacloud.com/pod-eip-instanceid |
"eip-bp14q***" |
The ID of an existing EIP to associate with the pod. For more information, see Apply for an EIP. | |
k8s.aliyun.com/eci-eip-instanceid |
Compatible with Elastic Container Instance (ECI). Same effect as network.alibabacloud.com/pod-eip-instanceid. |
||
network.alibabacloud.com/eip-bandwidth |
"5" |
Maximum bandwidth of the EIP, in Mbit/s. | |
network.alibabacloud.com/eip-internet-charge-type |
"PayByTraffic" |
Billing method for EIP traffic. Valid values: PayByTraffic (default), PayByBandwidth. For billing details, see Billing overview. |
|
k8s.aliyun.com/eip-charge-type |
Compatible with earlier versions. Same effect as network.alibabacloud.com/eip-internet-charge-type. |
||
network.alibabacloud.com/eip-instance-charge-type |
"PrePaid" |
EIP billing type. Valid values: PrePaid (subscription), PostPaid (pay-as-you-go). See Subscription and Pay-as-you-go. |
|
network.alibabacloud.com/eip-common-bandwidth-package-id |
"cbwp-slex***" |
The ID of the Internet Shared Bandwidth instance to use. | |
network.alibabacloud.com/eip-isp |
"BGP" |
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 an EIP. |
|
network.alibabacloud.com/eip-public-ip-address-pool-id |
"pippool-dlsw***" |
The IP address pool to use. For more information, see Create and manage an IP address pool. | |
network.alibabacloud.com/eip-resource-group-id |
The resource group to which the EIP belongs. For more information, see Apply for an EIP. | ||
network.alibabacloud.com/eip-name |
The name of the EIP. For more information, see Apply for an EIP. | ||
network.alibabacloud.com/eip-description |
The description of the EIP. For more information, see Apply for an EIP. | ||
network.alibabacloud.com/eip-security-protection-types |
Security services for the EIP. Separate multiple values with commas (,). For more information, see Apply for an EIP. |
||
network.alibabacloud.com/pod-eip-release-strategy |
"Never" |
EIP release policy. Valid values: Follow (default) — releases the EIP when the pod is deleted; Never — keeps the EIP after pod deletion, requiring manual release; time expression (e.g., 5m30s) — releases the EIP after the specified duration following pod deletion. Go time expressions are supported. |
Image annotations
| Feature | Annotation | Example | Description |
|---|---|---|---|
| Use a self-managed image repository | registry.alibabacloud.com/plain-http-registry |
"harbor*.pre.com,192.168.XX.XX:5000,reg*.test.com:80" |
Required when pulling images from a self-managed registry that uses HTTP. Prevents pull failures caused by protocol mismatches. Separate multiple registries with commas. |
registry.alibabacloud.com/insecure-registry |
"harbor*.pre.com,192.168.XX.XX:5000,reg*.test.com:80" |
Required when pulling images from a self-managed registry that uses a self-signed certificate. Skips certificate verification to prevent authentication failures. Separate multiple registries with commas. |
Annotations added by ACS
The following annotations are set by ACS automatically and reflect allocation results such as the elastic network interface (ENI) and EIP assigned to the pod. Do not set or modify these annotations manually.
| Annotation | Example | Description |
|---|---|---|
network.alibabacloud.com/allocated-eni-id |
"eni-esdxs***" |
The ID of the ENI assigned to the pod. |
network.alibabacloud.com/vpc-id |
"vpc-sljwo***" |
The ID of the virtual private cloud (VPC) where the ENI resides. |
network.alibabacloud.com/vswitch-id |
"vsw-lskdw***" |
The ID of the vSwitch where the ENI resides. If multiple vSwitches were specified at pod creation, this shows the one actually used. |
network.alibabacloud.com/allocated-eip-id |
"eip-bp1m***" |
The ID of the EIP assigned to the pod. |
network.alibabacloud.com/allocated-eip-address |
"116.62.***" |
The IP address of the EIP assigned to the pod. |
alibabacloud.com/pod-use-spec |
"2.5-5Gi" |
The CPU and memory specification of the pod, in the format <vCPU>-<memory>GiB. |
alibabacloud.com/pod-gpu-use-spec |
"1" |
The number of GPUs allocated to the pod. |
alibabacloud.com/pod-ephemeral-storage |
"30Gi" |
The ephemeral storage allocated to the pod, in GiB. |
topology.kubernetes.io/region |
"cn-hangzhou" |
The region where the pod is running. |
topology.kubernetes.io/zone |
"cn-hangzhou-i" |
The zone where the pod is running. |
alibabacloud.com/instance-id |
"acs-sdsf***" |
The instance ID of the pod. |
alibabacloud.com/request-id |
"6925D4B7-***" |
The request ID for the pod creation request. |
该文章对您有帮助吗?