Updated on 2023-09-26 GMT+08:00

Using an EIPPool

After creating an EIPPool in the namespace, add the specified annotation yangtse.io/eip-pool to the pod template to use the EIPs of the EIPPool. When a pod is created, an available EIP is automatically obtained from the EIPPool and bound to the pod.

EIPs that are being used by an EIPPool cannot be bound, unbound, or deleted on the VPC console. Therefore, you are not advised to perform operations on such EIPs on the VPC console.

The following uses eippool-demo1 as an example.

apiVersion: v1
kind: Pod
metadata:
  annotations:
   yangtse.io/eip-pool:eippool-demo1    # Use EIPs by specifying an EIPPool.
...

Run the following command to view the EIPPool details. (-n indicates the namespace to which the EIPPool belongs.)

In the command output, the usage of the eippool-demo1 EIPPool increases by 1, indicating that an EIP is successfully bound to the pod.

# kubectl get eippool -n $namespace_name
NAME                      EIPS               USAGE   AGE
eippool-demo1                                1/3     64m

After the pod is started, you can add the annotation yangtse.io/allocated-ipv4-eip to query the EIP used by the pod.

apiVersion:v1
kind:Pod
metadata:
  annotations:
    yangtse.io/allocated-ipv4-eip: 116.205.XXX.XXX      # EIP allocated to the pod

If a pod is rebuilt, it will re-obtain an available EIP from the EIPPool.