Virtual IPs
A Virtual IP (VIP) is a private address in a VPC subnet that isn’t tied to any one VM. You choose the address, and you name the VMs that may answer for it (the announcers). Whichever announcer currently holds the address receives its traffic, so if that VM fails, another announcer can take the address over and your service keeps the same address.
IBEE Virtual IPs are built for MetalLB, the tool that gives Kubernetes LoadBalancer services a stable address on clusters you run yourself on VMs.
When to use a Virtual IP
How it works
- You reserve the address in a subnet. IBEE marks it as taken, so it is never given to a VM.
- You choose the announcer VMs. IBEE allows those VMs, and only those, to use the address on the VPC network.
- MetalLB on the announcers takes the address. One node answers for it at a time; if that node fails, MetalLB moves the address to another announcer.
- Optionally, you make it public by attaching a Reserved IP (a one-to-one mapping), or by forwarding one NAT gateway port to it.
Before you begin
- A VPC with Managed NAT Gateway connectivity (NAT, network address translation, lets private VMs share the gateway’s public address). Announcers must be NAT-connected VMs, and making the Virtual IP public needs the VPC’s NAT gateway. See VPC.
- The announcer VMs attached to the VPC, all in the same subnet as the Virtual IP, with NAT access.
- A free address in that subnet. Check which addresses are taken on the VPC’s Subnets tab (the private IP ledger).
- MetalLB installed on your Kubernetes cluster, which runs on those VMs.
- For public access: an unattached Reserved IP in the VPC’s location.
Reserve a Virtual IP
Open the VPC
In the sidebar, under Network & Security, click VPC, then open your VPC. Click the Reserved VIPs tab.
Open the dialog
Click Reserve Virtual IP. The button is available once the VPC has a subnet. The dialog says: “Claim a private address for MetalLB and authorize the nodes that may announce it. IPAM will not assign the address to a VM.” (IPAM is the part of IBEE that hands out addresses.)
Choose the subnet and address
Choose the Subnet, then enter the Private IP: an unused address inside the subnet, for example 10.144.4.17. These are refused:
Configure MetalLB
Give MetalLB the same address and tell it to announce on the local network (layer 2 mode). Apply this on your cluster:
Then create a Kubernetes service of type LoadBalancer; MetalLB gives it 10.144.4.17. Only the announcer VMs you ticked can use the address. If MetalLB runs on other nodes too, limit the L2Advertisement to the announcers with its nodeSelectors field.
Verify
-
On the Reserved VIPs tab, the Virtual IP’s Status is
available. -
In Kubernetes,
kubectl get svcshows10.144.4.17underEXTERNAL-IPfor your service. -
From another VM in the same VPC, connect to the service:
-m 5makescurlgive up after 5 seconds if nothing answers. -
To test failover, run this loop on the other VM, which tries once every 1 second, and stop the node that currently holds the address:
After a few
faillines, it printsokagain once MetalLB has moved the address to another announcer.
Expose a Virtual IP publicly
A Virtual IP is private. There are two ways to reach it from the internet. The VPC needs an available NAT gateway for either.
With a Reserved IP (all ports):
- On the Reserved VIPs tab, click Attach on the Virtual IP’s row.
- In Attach Reserved IP (“Create a one-to-one public mapping for MetalLB VIP 10.144.4.17.”), choose an unattached Reserved IP in the VPC’s location.
- Click Attach Reserved IP.
Traffic to the Reserved IP now reaches the Virtual IP, and replies go out through it. To stop public access, click Detach on the row and confirm Detach Reserved IP. The Virtual IP stays reserved, and the Reserved IP goes back to your list.
With a port forward (one port): add a NAT port forwarding rule with Destination type MetalLB VIP, and choose the Virtual IP.
In both cases, the announcers’ firewall groups must accept the service’s port.
Release a Virtual IP
Remove the address from your MetalLB configuration first. After release, IBEE can give the address to a VM, and two machines answering for one address breaks both.
- Detach any Reserved IP from the Virtual IP.
- Delete any port forwarding rule that targets it.
- On the Reserved VIPs tab, click the delete icon on its row, then Delete Reservation in the Delete Virtual IP Reservation dialog. You see “Virtual IP 10.144.4.17 released”.
Use the API
The public API has no Virtual IP operations yet. Reserve, attach, detach and release Virtual IPs in the portal. The one exception: a NAT port forwarding rule can target an existing Virtual IP with "target_type": "vip" and the announcers in target_vm_ids (POST /networking/vpcs/VPC-ID/nat-gateways/NAT-GATEWAY-ID/port-forwarding-rules).
