Configure IP Address Pools Using Eip

This document describes how to configure an Eip object, which functions as an IP address pool for PorterLB both in BGP mode and in Layer 2 mode.

PorterLB assigns IP addresses in Eip objects to LoadBalancer Services in the Kubernetes cluster. After that, PorterLB publishes routes destined for the Service IP addresses over BGP (in BGP mode), ARP (in Layer 2 mode for IPv4), or NDP (in Layer 2 mode for IPv6).

NOTE

Currently, PorterLB supports only IPv4 and will soon support IPv6.

Configure an Eip Object for PorterLB

You can create an Eip object to provide an IP address pool for PorterLB. The following is an example of the Eip YAML configuration:

  1. apiVersion: network.kubesphere.io/v1alpha2
  2. kind: Eip
  3. metadata:
  4. name: eip-sample-pool
  5. spec:
  6. address: 192.168.0.91-192.168.0.100
  7. protocol: layer2
  8. interface: eth0
  9. disable: false
  10. status:
  11. occupied: false
  12. usage: 1
  13. poolSize: 10
  14. used:
  15. "192.168.0.91": "default/test-svc"
  16. firstIP: 192.168.0.91
  17. lastIP: 192.168.0.100
  18. ready: true
  19. v4: true

The fields are described as follows:

metadata:

  • name: Name of the Eip object.

spec:

  • address: One or more IP addresses, which will be used by PorterLB. The value format can be:

    • IP address, for example, 192.168.0.100.
    • IP address/Subnet mask, for example, 192.168.0.0/24.
    • IP address 1-IP address 2, for example, 192.168.0.91-192.168.0.100.

    NOTE

    IP segments in different Eip objects cannot overlap. Otherwise, a resource creation error will occur.

  • protocol: Specifies which mode of PorterLB the Eip object is used for. The value can be either layer2 or bgp. If this field is not specified, the default value bgp is used.

  • interface: NIC on which PorterLB listens for ARP or NDP requests. This field is valid only when protocol is set to layer2.

    TIP

    If the NIC names of the Kubernetes cluster nodes are different, you can set the value to can_reach:IP address (for example, can_reach:192.168.0.5) so that PorterLB automatically obtains the name of the NIC that can reach the IP address. In this case, you must ensure that the IP address is not used by Kubernetes cluster nodes but can be reached by the cluster nodes.

  • disable: Specifies whether the Eip object is disabled. The value can be:

    • false: PorterLB can assign IP addresses in the Eip object to new LoadBalancer Services.
    • true: PorterLB stops assigning IP addresses in the Eip object to new LoadBalancer Services. Existing Services are not affected.

status: Fields under status specify the status of the Eip object and are automatically configured. When creating an Eip object, you do not need to configure these fields.

  • occupied: Specifies whether IP addresses in the Eip object have been used up.

  • usage: Specifies how many IP addresses in the Eip object have been assigned to Services.

  • used: Specifies the used IP addresses and the Services that use the IP addresses. The Services are displayed in the Namespace/Service name format (for example, default/test-svc).

  • poolSize: Total number of IP addresses in the Eip object.

  • firstIP: First IP address in the Eip object.

  • lastIP: Last IP address in the Eip object.

  • v4: Specifies whether the address family is IPv4. Currently, PorterLB supports only IPv4 and the value can only be true.

  • ready: Specifies whether the Eip-associated program used for BGP/ARP/NDP routes publishing has been initialized. The program is integrated in PorterLB.

Last modified February 25, 2021: Capitalized terms. (4ba1567)