Question

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

Posted August 24, 2020 548 views
Load BalancingKubernetes

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?

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.

×
1 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

Submit an Answer