<p>I'm used to connect to my cluster using <code>telepresence</code> and access cluster services locally.</p>

<p>Now, I need to make <strong>services in the cluster available to a group of applications that are running in docker containers locally</strong>. We can say that it's the inverse use case.</p>

<p>I've an app that is running in a docker container. It access services that are deploy using <code>docker-compose</code>. It has been done by using a network:</p>

<pre><code>docker network create myNetwork
// Make app 1 to use it
docker network connect myNetwork app1
// App 2 uses docker compose, so myNetwork is defined in it and here I just:
docker-compose up
</code></pre>

<p>My <code>app1</code> access correctly the containers/services running in <code>app2</code>. However, I still need it to access a service from my cluster!</p>

<p>I've tried make a tunnel from my host to the cluster with <code>telepresence</code> and then try to access the service as if it were in my host. However it seems not to work. If I go into my <code>app1</code> container and do a <code>curl</code> to see if the service name resolves:</p>

<blockquote>
  <p>curl: (6) Could not resolve host: my_cluster_service_name</p>
</blockquote>

<p>Is my approach wrong? Am I missing an operation or consideration? How could I accomplish it?</p>

<p>Docker version: <code>Docker version 19.03.8</code> for Mac </p>

Btc Sources
<p>I've find a way to solve the problem.</p>

<p>Instead of trying to use <code>telepresence</code> as for the inverse use case, solution comes by using a <code>port-forward</code> with <code>k9s</code>. When creating it, it's important to do not leave the default interface, that is set to <code>localhost</code>, and put <code>0.0.0.0</code> instead to ensure that it listens traffic from all interfaces.</p>

<p>Then I've changed my containers from inside, making the services to point to my host's IP when trying to resolve the service names. Use the method that better fits your case for this: since it's not a production environment I just tried hardcoding my host IP manually to check if the connectivity was achieved.</p>

<p>To point to an specific service of your cluster you need to use different ports since they will be all mapped to your host with different <code>port-forwards</code>. Name resolving is no longer needed.</p>

<p>With this configuration, your container request will reach your host, where the port-forward routes it to the cluster. Connectivity is OK with this setup and the problem is solved.</p>
