Question

How do I reserve a static public IP for a loadBalancer created through kubernetes

I deleted a service type LoadBalancer from my test k8s cluster and then re-applied it again specifying same IP as before in loadBalancerIP: but the load balancer was created with a different IP, as apparently someone else has grabbed that IP already… Now, to avoid this kind of issues how do I reserve a static public IP?

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Sri Charan Madhavapeddi
DigitalOcean Employee
DigitalOcean Employee badge
August 24, 2020
Accepted Answer

Hello, Thanks for reaching out to DigitalOcean!

In general, the moment you create a Droplet/Load Balancer, you will be assigned an Static IPv4 address automatically. Similarly, when you destroy the Droplet/Load Balancer, the IP address will be disassociated and will join the IP pool table. There is no way you can have one more Static IP address to the Droplet/Load Balancer or retain the same IP on our platform. Really sorry for the inconvenience!

Technically, you should just never destroy the LoadBalancer type Service in Kubernetes. Even if you don’t have any deployment or pod selectors set, just keep it around, to save the IP address.

The LB is roughly around $20 / month. So you’re paying $20/month for that IP. Provided you never destroy the LB type Service object in k8s, it will keep the LB on your account indefinitely.

Please let us know if you have any additional questions, and have a wonderful day!

Cheers, Sri Charan Madhavapeddi

Vote here for this feature: https://ideas.digitalocean.com/network/p/allow-floating-ips-to-point-to-load-balancers

Our company is using Istio for LB related stuff (IaC via Terraform), so it’s a real pain when our cluster is updated as it means we lose the external-ip that is assigned to it. Would be very helpful to have this feature.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.