Metal LB
Quick examples on configuring this operator. I’m assuming the operator is installed.
From the OCP Console select . In the search box type “metallb”.
Click Install. Leave defaults and Click Install again.
After operator installation completes, click “View Operator”.
Click “Create instance” to create the Metal LB instance.
Accept the defaults and click “Create” at the bottom of the page.
L2
Tip
To expose the VIP with a service see: Quick App Deployment
There you’ll find how to deploy a generic httpd service and expose a LoadBalancer Service.
Important
You need a LoadBalancer Service for this to work.
Create the IP Address Pool
cat << EOF | oc create -f - apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: name: ipaddrpool-v132 namespace: metallb-system spec: addresses: - 192.168.132.225-192.168.132.229 EOF
Create the L2 Advertisement
cat << EOF | oc create -f - kind: L2Advertisement apiVersion: metallb.io/v1beta1 metadata: name: l2-adv-v132 namespace: metallb-system spec: ipAddressPools: - ipaddrpool-v132 EOF
BGP
See also
Create the IP Address Pool
cat << EOF | oc create -f - apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: name: ipaddrpool-v245 namespace: metallb-system spec: addresses: - 192.168.245.201-192.168.245.225 EOF
Create the BGP Peer
cat << EOF | oc create -f - kind: BGPPeer apiVersion: metallb.io/v1beta2 metadata: name: bgp-peer-v245 namespace: metallb-system spec: myASN: 64512 peerASN: 64512 peerAddress: 192.168.132.1 EOF
Creat the BGP Advertisement
cat << EOF | oc create -f - kind: BGPAdvertisement apiVersion: metallb.io/v1beta1 metadata: name: bgp-adv-v245 namespace: metallb-system spec: ipAddressPools: - ipaddrpool-v245 peers: - bgp-peer-v245 EOF