<p>I have 2 kubernetes cluster</p>
<p>cluster 2 - exposed loadblancer nginx with regional IP <code>IP_PRIVATE</code></p>
<pre><code>service 1 - website `/website`
service 2 - blog `blog`
service 3 - api `api`
</code></pre>
<p>cluster 1 - exposed loadblancer gce with global IP <code>IP_PUBLIC</code></p>
<p>I want to implement this behaviour</p>
<pre><code>IP_PUBLIC/api -&gt; service 2 response

IP_PUBLIC/* -&gt; cdn -&gt; service 1 response
</code></pre>
<p>To implement this I have created cdn service layer in cluster 1 as defined here <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#expandable-1" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-features#expandable-1</a></p>
<p>Now my domain will be mapped to IP_PUBLIC hence any request will hit cluster 1 first then it should pass the request to cluster 2 and get the response.</p>
<p><strong>Note</strong>: I have to create 2 clusters because</p>
<ol>
<li>I don't want to change anything in cluster</li>
<li>I cant have global IP with nginx ingress</li>
<li>I cant have 2 loadbalancer (both gce and nginx) in one cluster</li>
</ol>
<p>I want to pass the exact request (domain, headers etc) from cluster 1 to cluster 2 as if the request is directly hiting the cluster 2.</p>
<p>What is the correct way to do this? In case there is any alternate solution to achieve the above with minimum changes then please suggest.</p>

<p>i am not sure which ingress you are running in the background however you can change the config using the annotation.</p>
<p>You can enable passing the headers on <strong>Nginx</strong> using this annotation so it will forward all the custom headers and domain details.</p>
<pre><code>enable-underscores-in-headers: true
</code></pre>
<p>with</p>
<pre><code>nginx.ingress.kubernetes.io/configuration-snippet: |
  proxy_set_header My-Custom-Header $http_my_custom_header;
</code></pre>
<p>But I am not sure one part when you say :</p>
<blockquote>
<p>Now my domain will be mapped to IP_PUBLIC hence any request will hit
cluster 1 first then it should pass the request to cluster 2 and get
the response.</p>
</blockquote>
<p>One your request hit to domain traffic will maybe flows like</p>
<pre><code>Request &gt; domain &gt; cluster 1 &gt; cluster 1's service &gt; IP or Domain of cluster 2 &gt; cluster 2's ingress controller &gt; cluster 2's service
</code></pre>
<p>in this case you need to pass the headers to request and enable ingress config on cluster2's controller so it will forward to details to backend service running on <strong>cluster2</strong>.</p>
<p>Also not sure how your <strong>egress</strong> traffic moving out of the cluster using <strong>NAT gateway</strong> or directly from node, considering you have a public cluster your service will be directly calling cluster2's domain in that case you have to add the headers with request.</p>
<p>Just set the proper annotation to ingress and your backend services will get the headers with domain details.</p>
