oracle-databasekubernetesservicestaticstatic-ip-address

How to setup static LoadBalancer IP for a service in OCI kubernetes cluster?


I have a 3-node OKE cluster setup in Oracle cloud.

I deployed an nginx ingress controller in the cluster. I'm mapping the FQDN test.myapp.com to the EXTERNAL_IP of that nginx ingress controller service.

Whenever I re-install the ingress controller during the time of testing, it gets different EXTERNAL_IP and I have to map the FQDN again to that new IP.

So it will be better if I can specify a static loadBalancer IP during the time of nginx ingress controller installation. Like this:

nginx-ingress:
  controller:
    service:
      loadBalancerIP: "125.23.119.23"

How can I achieve this in Oracle cloud (with OKE)?


Solution

  • Oracle cloud Infrastructure(OCI) supports creating LoadBalancer services in kubernetes clusters, and allows setting the LoadBalancerIP parameter too.

    But first, you have to create a Reserved Public IP address in OCI, and then specify that IP address as LoadBalancerIP of your service.

    You can do it as :

    That means, when you create a Reserved Public IP, you are just reserving it for future use. A layer-4 load balancer is created and associated with that IP address only when a LoadBalancer type service is created with this Reserved IP address.

    If you delete that LoadBalancer type service, the layer-4 loadbalancer also gets deleted. But the Reserved public IP still remains there. You can assign that IP address to another service next time.

    These documentations have explanations regarding this topic :