<p>I have a 3-node OKE cluster setup in Oracle cloud.</p>
<p>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.</p>
<p>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.</p>
<p>So it will be better if I can specify a static loadBalancer IP during the time of nginx ingress controller installation. Like this:</p>
<pre><code>nginx-ingress:
  controller:
    service:
      loadBalancerIP: &quot;125.23.119.23&quot;
</code></pre>
<p>How can I achieve this in Oracle cloud (with OKE)?</p>

<p>Oracle cloud Infrastructure(OCI) supports creating <code>LoadBalancer</code> services in kubernetes clusters, and allows setting the <code>LoadBalancerIP</code> parameter too.</p>
<p>But first, you have to create a <strong>Reserved Public IP address</strong> in OCI, and then specify that IP address as <code>LoadBalancerIP</code> of your service.</p>
<p>You can do it as :</p>
<ul>
<li><p>Go to OCI console :<br>
<code>Networking -&gt; IP management -&gt; Reserved Public IPs</code>.<br> Click on <code>Reserve Public IP Address</code><br>
Provide a name, and select source <code>Oracle</code> if that is the only public IP pool you have (default).<br>
Click on the Reserve button to get a reserved public IP address.</p>
</li>
<li><p>In OCI console, look at : <br>
<code>Networking -&gt; IP management -&gt; Reserved Public IPs</code> <br>
( You can see a <strong>Reserved Public IP</strong> there, but not attached to any VNIC) <br>
<code>Networking -&gt; Load Balancers</code> <br>
( No Loadbalancers are listed with the IP address that we reserved )</p>
</li>
<li><p>Create a <code>LoadBalancer</code> type service in kubernetes cluster using <code>kubectl</code> with <code>LoadbalancerIP</code> provided with value of our Reserved IP Address.</p>
</li>
<li><p>Check <code>kubectl get svc</code>, and you can see that the Reserved Public IP address is assigned to the service.</p>
</li>
<li><p>In  OCI console, look at : <br>
<code>Networking -&gt; IP management -&gt; Reserved Public IPs</code> <br>
( You can see a public IP address reserved, attached to a VNIC for an LB) <br>
<code>Networking -&gt; Load Balancers</code> <br>
( A layer-4 Loadbalancer is added automatically with the IP address that we reserved )</p>
</li>
</ul>
<p>That means, when you create a <code>Reserved Public IP</code>, you are just reserving it for future use. A layer-4 load balancer is created and associated with that IP address only when a <code>LoadBalancer</code> type service is created with this Reserved IP address.</p>
<p>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.</p>
<p>These documentations have explanations regarding this topic :</p>
<ul>
<li><p><a href="https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcreatingloadbalancer.htm#contengcreatingloadbalancer_topic_Specifying_Load_Balancer_Reserved_IP" rel="nofollow noreferrer">https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengcreatingloadbalancer.htm#contengcreatingloadbalancer_topic_Specifying_Load_Balancer_Reserved_IP</a></p>
</li>
<li><p><a href="https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingpublicIPs.htm#console-reserved" rel="nofollow noreferrer">https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/managingpublicIPs.htm#console-reserved</a></p>
</li>
</ul>
