<p>Right now I got an architecture like this:</p>

<pre><code>          internet
             |
   [ IngressController ]
        |          |
   [ Ingress A] [ Ingress B]
   --|-----|--  --|-----|--
   [ Service A] [ Service B]
         |            |
     [ Pod A]     [ Pod B]
</code></pre>

<p>So if <code>Service A</code> request data from <code>Service B</code> it is using the <code>full qualified name</code>, e.g. </p>

<blockquote>
  <p><code>ResponseEntity&lt;Object&gt; response = restTemplate.exchange(host.com/serviceB, HttpMethod.POST, entity, Object.class);</code></p>
</blockquote>

<p>As all of them are in the same cluster I would try to change the architecture to improve communication between the services. I imagined something like this:</p>

<pre><code>          internet
             |
   [ IngressController ]
        |          |
   [ Ingress A] [ Ingress B]
   --|-----|--  --|-----|--
   [ Service A]-[ Service B]
         |            |
     [ Pod A]     [ Pod B]
</code></pre>

<p>So the services would be allowed to request each other via the name only or something. I am just not sure how to realize this using <code>REST-Services</code>.</p>

<p>You need to call <code>Service B</code> by it's <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">Kubernetes DNS name</a> and it should connect directly without going through the ingress.</p>

<p>To clarify <code>Service A</code> doesn't talk to <code>Service B</code>, but rather <code>Pod A</code> talks to <code>Service B</code> and <code>Pod B</code> talks to <code>Service A</code>. So, long all pods and services are in the same <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/" rel="nofollow noreferrer">Kubernetes namespace</a>, you can communicate with the service with the service name as the hostname and that will resolve to the internal IP address of the service and then forward the traffic to the pod.</p>

<p>If the pods happen to be in different namespaces you would connect with the namespace name added to the service: <code>&lt;service-name&gt;.&lt;namespace-name&gt;</code> or with <code>&lt;service-name&gt;.&lt;namespace-name&gt;.svc.cluster.local</code></p>

<p>Hope it helps.</p>
