<h1>What I have:</h1>
<p>I have difficulty setting up an Ingress with Helm Chart on the cloud.<br></p>
<ul>
<li>I have a project with a Front, a Back and a MySQL database.</li>
<li>I setup two Ingress, one for my <strong>BackEnd</strong> and one for my <strong>FrontEnd</strong>, I can access it with an IP given by <strong>Google Cloud Platform</strong>.</li>
</ul>
<p>In the <strong>FrontEnd</strong> and <strong>BackEnd</strong> charts <code>values.yaml</code>:</p>
<pre><code>...
service:
  type: LoadBalancer
  port: 8000 # 4200 for the FrontEnd
  targetPort: 8000 # 4200 for FrontEnd

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/enable-cors: &quot;true&quot;
    nginx.ingress.kubernetes.io/cors-allow-origin: &quot;*&quot;
    nginx.ingress.kubernetes.io/cors-allow-methods: &quot;PUT, GET, POST, OPTIONS, DELETE&quot;
    nginx.ingress.kubernetes.io/cors-allow-headers: &quot;DNT,X-CustomHeader,X-LANG,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-ConSSH / 51970trol,Content-Type,X-Api-Key,X-Device-Id,Access-Control-Allow-Origin&quot;
  hosts:
    - paths:
        - path: /
          pathType: ImplementationSpecific
...
</code></pre>
<h1>My Issue:</h1>
<p>The <strong>FrontEnd</strong> needs to talk to the <strong>BackEnd</strong> throughout the Ingress.<br>
In the <strong>FrontEnd</strong> values.yaml, I need to have a value:<br>
<code>BACKEND_URL: XXX.XXX.XXX.XXX:8000</code><br>
But I don't know the URL of the <strong>BackEnd</strong> Ingress, or at least, until I deploy the back.</p>
<ul>
<li>How can I variabilize it, to retrieve the URL ingress of the <strong>BackEnd</strong>?</li>
<li>Or at least, how can I find the ingress IP? (I've tried kubectl get ingress, it doesn't show the address).</li>
</ul>

Hamza Ince
<p>You have two options:</p>
<ol>
<li><p>Don't use the ingress but the service DNS name. This way your traffic doesn't even leave the cluster. If your backend service is called <code>api</code> and deployed in the <code>backend</code> namespace you can reach it internally using <code>api.backend</code>. <a href="https://kubernetes.io/docs/concepts/services-networking/service/#dns" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#dns</a> has details about the mechanism.</p>
</li>
<li><p>You reserve the IP on GCP side and pass the IP as a parameter to your helm charts. If you don't, each deletion and recreation of the service will end up on a different IP by GCP. Clients who have a cached DNS response will not be able to use your service until it has expired.</p>
</li>
</ol>
<p>For GCP this snippet from the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer" rel="nofollow noreferrer">documentation</a> is correct.</p>
<blockquote>
<p>Some cloud providers allow you to specify the <code>loadBalancerIP</code>. In those cases, the load-balancer is created with the user-specified <code>loadBalancerIP</code>. If the <code>loadBalancerIP</code> field is not specified, the loadBalancer is set up with an ephemeral IP address. If you specify a <code>loadBalancerIP</code> but your cloud provider does not support the feature, the <code>loadbalancerIP</code> field that you set is ignored.</p>
</blockquote>
<p>So get a permanent IP and pass it as <code>loadBalancerIP</code> to the service.</p>
<pre><code>  service:
    spec:
      type: LoadBalancer
      port: 8000 # 4200 for the FrontEnd
      targetPort: 8000 # 4200 for FrontEnd
      loadBalancerIP: &lt;the Global or Regional IP you got from GCP (depends on the LB)&gt;
</code></pre>
