As a cluster administrator, you can add address pools to your cluster to control the IP addresses that MetalLB can assign to load-balancer services.
Procedure
-
Create a file, such as ipaddresspool.yaml
, with content like the following example:
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
namespace: metallb-system
name: doc-example
labels: (1)
zone: east
spec:
addresses:
- 203.0.113.1-203.0.113.10
- 203.0.113.65-203.0.113.75
1 |
This label assigned to the IPAddressPool can be referenced by the ipAddressPoolSelectors in the BGPAdvertisement CRD to associate the IPAddressPool with the advertisement. |
-
Apply the configuration for the IP address pool:
$ oc apply -f ipaddresspool.yaml
Verification
-
View the address pool:
$ oc describe -n metallb-system IPAddressPool doc-example
Example output
Name: doc-example
Namespace: metallb-system
Labels: zone=east
Annotations: <none>
API Version: metallb.io/v1beta1
Kind: IPAddressPool
Metadata:
...
Spec:
Addresses:
203.0.113.1-203.0.113.10
203.0.113.65-203.0.113.75
Auto Assign: true
Events: <none>
Confirm that the address pool name, such as doc-example
, and the IP address ranges appear in the output.