All Products
Search
Document Center

Container Compute Service:Annotations for attaching an EIP to a pod

Last Updated:Sep 02, 2025

In an Alibaba Cloud Container Service for Kubernetes (ACS) cluster, you can use annotations to attach an elastic IP address (EIP) to a pod and set the EIP release policy.

Important

Before you read this topic, make sure that you have installed the ack-extend-network-controller component and understand how to configure and attach an EIP to a pod in an ACS cluster.

Annotations for enabling the EIP feature

ACS supports using annotations to enable the EIP feature. You can automatically allocate an EIP or assign a static EIP to a pod as needed.

Automatically create and associate an EIP with a pod

Important

When you use the automatic EIP allocation feature, EIPs may be repeatedly requested and released. For example, this issue occurs when the pod is recreated or the Container Network Interface (CNI) component fails to configure the network. To avoid this issue, you can specify an EIP instance.

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:

  • true: Automatically create and attach an EIP.

  • false: Do not automatically create and attach an EIP.

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:

  • PayByTraffic: (Default) pay-by-traffic.

  • 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

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

The Internet Shared Bandwidth instance that you want to use.

network.alibabacloud.com/eip-isp

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

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 EIPs.

network.alibabacloud.com/eip-name

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

network.alibabacloud.com/eip-description

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

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

The security protection level of the EIP. If you configure multiple levels, separate them with a comma (,). For more information, see Request an EIP.

Specify an EIP instance

You can attach an existing EIP by specifying its instance ID. The pod annotation does not modify the EIP instance configuration. It only attaches the EIP to the specified pod.

Important
  • This feature is not applicable to controllers with multiple replicas. We recommend that you use this feature only in a StatefulSet for a stateful application.

  • We recommend that you attach a single EIP instance to only one pod. The EIP controller detaches the EIP after the pod exits. During this period, the EIP instance cannot be used by other containers. To avoid business interruptions, you can check whether a pod EIP resource with the same name as the pod exists to determine whether the pod and the EIP are detached.

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 EIPs.

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

Annotation for configuring the EIP release policy

ACS supports using an annotation to set the release policy for a pod EIP. You can choose to release the EIP with the pod, never release the EIP, or configure an expiration time for the EIP as needed.

Important
  • This feature is applicable only to StatefulSets for stateful applications. It cannot be used in deployments for stateless applications.

  • 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:

  • Follow: (Default) Follows the pod lifecycle.

  • Never: Never deletes the pod EIP. You must manually delete the pod EIP when it is no longer needed.

  • Configure an expiration time. For example, 5m30s indicates that the pod EIP is deleted 5 minutes and 30 seconds after the pod is deleted. Time expressions in Go format are supported.

Note

For the reclaim policy with a configured expiration time, after a pod of a stateful application is deleted, the pod EIP is retained for a period of time before it is deleted. A pod with the same name that is created during this period continues to use the same EIP. This policy can be used with the automatic EIP allocation feature in scenarios where a stateful application requires a static EIP.