You can add pod annotations to associate an exclusive elastic IP address (EIP) with a pod in an Alibaba Cloud Container Compute Service (ACS) cluster. This topic describes the annotations used to associate an exclusive EIP with a pod, enable the EIP feature, and set the EIP release policy.
Annotations for enabling the EIP feature
ACS allows you to add annotations to enable the EIP feature. You can choose to automatically create and associate EIPs with pods and manually associate EIPs with pods. For more information, see Mount an independent EIP for pods.
Automatically create and associate an EIP with a pod
If you use the automatic EIP allocation feature, the system may repeatedly apply for and release EIPs. For example, this issue occurs when the pod is recreated or the Container Network Interface (CNI) plug-in fails to configure the network. To avoid this problem, you can choose to manually associate an EIP with a pod.
Pod annotation | Description |
network.alibabacloud.com/pod-with-eip | Specifies whether to automatically create an EIP and associate the EIP with a pod. Valid values:
|
network.alibabacloud.com/eip-bandwidth | The maximum bandwidth of the EIP. Unit: Mbit/s. |
network.alibabacloud.com/eip-internet-charge-type | The metering method of the EIP. Valid values:
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 | The billing method of the EIP. Valid values:
For more information, see Subscription and Pay-as-you-go. |
network.alibabacloud.com/eip-common-bandwidth-package-id | The Internet Shared Bandwidth instance that you want to use. |
network.alibabacloud.com/eip-isp | The line type of the EIP. Valid values:
For more information, see Apply for an EIP. |
network.alibabacloud.com/eip-public-ip-address-pool-id | The IP address pool. 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 | The security services used to protect the EIP. Separate multiple security services with commas ( |
Manually associate an EIP with a pod
You can associate an existing EIP with a pod by specifying the ID of the EIP. The pod annotations do not modify the configurations of the EIP. The annotations only associate the EIP with the specified pod.
This feature is not suitable for controllers that deploy more than one replicated pod. We recommend that you use this feature only in StatefulSets.
We recommend that you associate an EIP with only one pod. The EIP controller automatically disassociates the EIP after the pod terminates. You cannot use the EIP in other pods during this period of time. To avoid business interruptions, you can check whether an EIP resource using the same name of the pod exist to determine whether the EIP has been disassociated from the pod.
Pod annotation | Description |
network.alibabacloud.com/pod-eip-instanceid | The ID of the EIP that you want to use, such as eip-bp14qxxxxxxx. For more information, see Apply for an EIP. |
k8s.aliyun.com/eci-eip-instanceid (compatible with Elastic Container Instance) |
Annotation for configuring the EIP release policy
ACS allows you to add an annotation to configure the EIP release policy. You can configure an EIP to follow the lifecycle of the associated pod, retain the EIP, or set the expiration time of the EIP.
This feature applies only to StatefulSets. You cannot use this feature in Deployments.
You can specify an EIP by its ID. The specified EIP will not be released.
Pod annotation | Description |
network.alibabacloud.com/pod-eip-release-strategy | The EIP release policy. Valid values:
Note After you configure the EIP release policy, if a StatefulSet pod is deleted, the EIP of the pod is retained for a period of time before it is released. If you create a pod with the same name during this time period, the pod will use the EIP. You can use this feature with automatic EIP allocation to associate fixed EIPs with StatefulSet pods. |