<p>I have been trying to port over some infrastructure to K8S from a VM docker setup.</p>
<p>In a traditional VM docker setup I run 2 docker containers: 1 being a proxy node service, and another utilizing the proxy container through an <code>.env</code> file via:
<code>docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' proxy-container</code></p>
<blockquote>
<p>172.17.0.2</p>
</blockquote>
<p>Then within the <code>.env</code> file:
<code>URL=ws://172.17.0.2:4000/</code></p>
<p>This is what I am trying to setup within a cluster in K8S but failing to reference the proxy-service correctly. I have tried using the proxy-service pod name and/or the service name with no luck.</p>
<p>My <code>env-configmap.yaml</code> is:</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: env-config
data:
  URL: &quot;ws://$(proxy-service):4000/&quot;
</code></pre>

Matt - Block-Farms.io
<p>Containers that run in the same pod can connect to each other via <code>localhost</code>. Try <code>URL: &quot;ws://localhost:4000/&quot;</code> in your ConfigMap. Otherwise, you need to specify the service name like <code>URL: &quot;ws://proxy-service.&lt;namespace&gt;:4000&quot;</code>.</p>
