<p>Let's say we have a frontend and a backend pods running in a kubernetes cluster.</p>
<p>Both pods have corresponding services exposing them on the host (type: <code>NodePort</code>). In the end, the frontend uses <code>&lt;Host IP&gt;:&lt;Port 1&gt;</code>, and the backend runs on <code>&lt;Host IP&gt;:&lt;Port 2&gt;</code>.</p>
<p>How to find out the host IP so that it could be used in the frontend pod (to be defined as a value of a variable)? Tried with setting <code>localhost</code>, but it didn't work, so probably the exact IP has to be defined.</p>

AbreQueVoy
<p>Use the <a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/" rel="noreferrer">downward API</a>:</p>
<pre><code>spec:
  image: ...
  env:
   - name: REACT_APP_BACKEND_URL
     valueFrom:
       fieldRef:
         fieldPath: status.hostIP
</code></pre>
