How to keep a fixed Floating IP for load balancer services
Estimated time to read: 1 minute
By default, the Floating IP of a type: LoadBalancer service is released when the service is deleted. If the service is recreated, for example by ArgoCD or a Helm reinstall, it gets a new address and the old one can be assigned to someone else.
To pin the Floating IP, add the keep-floatingip annotation and set spec.loadBalancerIP:
kind: Service
apiVersion: v1
metadata:
name: my-service
namespace: default
annotations:
loadbalancer.openstack.org/keep-floatingip: "true"
spec:
type: LoadBalancer
loadBalancerIP: 81.24.7.20
...
loadbalancer.openstack.org/keep-floatingip: "true"keeps the Floating IP in your project when the service is deleted.spec.loadBalancerIPmakes the (recreated) service use that specific Floating IP. Use the current external IP of the service, or a Floating IP you allocated in the same project via the dashboard.
Info
A kept Floating IP is billed until you return it.
For more load balancer options, see the OpenStack Cloud Controller documentation.