<p>I have two (independent) Kubernetes clusters, one setup as a GKE/GCE cluster and the other setup in an AWS environment created using the <code>kube-up.sh</code> script. Both clusters are working properly and I can start / stop pods, services, and everything else between.</p>

<p>I want pods located in these clusters to communicate with each other, but without exposing them as services. In order to achieve this, I have setup a VPN connection between the two clusters, and also a couple of routing / firewall rules to make sure the VMs / pods can see each other. </p>

<p>I can confirm that the following scenarios are working properly:</p>

<p>VM in GCE -> VM in AWS (OK)</p>

<p>Pod in GCE -> VM in AWS (OK)</p>

<p>VM in AWS -> VM in GCE (OK)</p>

<p>VM in AWS -> Pod in GCE (OK)</p>

<p>Pod in AWS -> Pod in GCE (OK)</p>

<p>However, I can't make a VM or Pod in GCE communicate with a Pod in AWS.</p>

<p>I was wondering if <em>there is</em> any way of making this work with current AWS VPC capabilities. It seems that when the AWS end of the VPN tunnel receives packets addressed to a pod, it doesn't really know what to do with them. On the other hand, GCE networking is automatically configured with routes that associate pod IPs to a GKE cluster. In this case, when a packet addressed to a pod reaches the GCE end of the VPN tunnel, it is correctly forwarded to its destination.</p>

<p>That's my configuration:</p>

<p><strong>GKE/GCE in us-east1</strong></p>

<p><em>Network</em>: <code>10.142.0.0/20</code></p>

<p><em>VM1 IP</em>: <code>10.142.0.2</code></p>

<p><em>Pod range (for VM1)</em> : <code>10.52.4.0/24</code></p>

<p><em>Pod1 IP</em>: <code>10.52.4.4</code> (running busybox)</p>

<p><em>Firewall rule</em>: Allows any traffic from <code>172.16.0.0/12</code></p>

<p><em>Route</em>: Sends everything with destination <code>172.16.0.0/12</code> to the VPN tunnel (automatically added when the VPN is created)</p>

<p><strong>AWS in ap-northeast-1</strong></p>

<p><em>VPC</em>: <code>172.24.0.0/16</code></p>

<p><em>Subnet1</em>: <code>172.24.1.0/24</code></p>

<p><em>VM3 IP (in Subnet1)</em>: <code>172.24.1.5</code></p>

<p><em>Kubernetes cluster network</em> (<code>NON_MASQUERADE_CIDR</code>): <code>172.16.0.0/16</code></p>

<p><em>Pod range</em> (<code>CLUSTER_IP_RANGE</code>): <code>172.16.128.0/17</code></p>

<p><em>Pod range (for VM3)</em> : <code>172.16.129.0/24</code></p>

<p><em>Pod3 IP</em>: <code>172.16.129.5</code></p>

<p><em>Security Group</em>: Allows any traffic from 10.0.0.0/8</p>

<p><em>Routes</em>: </p>

<ol>
<li>Destination <code>10.0.0.0/8</code> to the VPN tunnel</li>
<li>Destination <code>172.16.129.0/24</code> to VM3</li>
</ol>

<p>Has anyone tried to do something similar? Is there any way to configure AWS VPC VPN Gateway to ensure the packets destined to Pods are correctly sent to the VMs that host them? Any suggestions?</p>

<p>What you are asking in kubernetes <a href="https://kubernetes.io/docs/concepts/cluster-administration/federation/" rel="nofollow noreferrer">federation</a>. </p>

<blockquote>
  <p>Federation makes it easy to manage multiple clusters. It does so by
  providing 2 major building blocks:</p>
  
  <ul>
  <li><p>Sync resources across clusters: Federation provides the ability to keep resources in multiple clusters in sync. This can be used, for
  example, to ensure that the same deployment exists in multiple
  clusters.</p></li>
  <li><p>Cross cluster discovery: It provides the ability to auto-configure DNS servers and load balancers with backends from all clusters. This
  can be used, for example, to ensure that a global VIP or DNS record
  can be used to access backends from multiple clusters.</p></li>
  </ul>
</blockquote>

<p>Also,this one might help you <a href="https://kubernetes.io/docs/admin/multiple-zones/" rel="nofollow noreferrer">https://kubernetes.io/docs/admin/multiple-zones/</a></p>
