<p>I'm using GKE for deployments.</p>
<p><strong>Edit</strong>: I need to access a customer's API endpoint which is only accessible when using their VPN. So far I can run a container which connects to this VPN and I can cURL the endpoint successfully.</p>
<p>For the above, I have configured a Debian docker image which successfully connects to a VPN (specifically, using Kerio Control VPN) when deployed. Whenever I make a net request from this container, it runs through the VPN connection, as expected.</p>
<p>I have another image which runs a .NET Core program which makes necessary HTTP requests.</p>
<p>From <a href="https://jordanelver.co.uk/blog/2019/06/03/routing-docker-traffic-through-a-vpn-connection/" rel="nofollow noreferrer">this guide</a> I know it is possible to run a container's traffic through another using pure docker. Specifically using the <code>--net=container:something</code> option (trimmed the example):</p>
<pre><code>docker run \
  --name=jackett \
  --net=container:vpncontainer \
  linuxserver/jackett
</code></pre>
<p>However, I have to use Kubernetes for this deployment so I think it would be good to use a 2-container pod. I want to keep the VPN connection logic and the program separated.</p>
<p>How can I achieve this?</p>

picheto
<p>Based on your comment I think I can advise you two methods.</p>
<ol>
<li><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept" rel="nofollow noreferrer">Private GKE Cluster</a> with <a href="https://cloud.google.com/nat/docs/overview" rel="nofollow noreferrer">CloudNAT</a></li>
</ol>
<p>In this setup, you should you use <code>Private GKE cluster</code> with <code>CloudNAT</code> for external communication. You would need to to use <a href="https://cloud.google.com/nat/docs/using-nat#specify_ip_addresses_for_nat" rel="nofollow noreferrer">manual externalIP</a>.
This scenario is using specific <code>externalIP</code> for VPN connection, but it's required from your customer to <code>whitelist</code> access for this IP.</p>
<ol start="2">
<li>Site to site VPN using <a href="https://cloud.google.com/network-connectivity/docs/vpn/concepts/overview" rel="nofollow noreferrer">CloudVPN</a></li>
</ol>
<p>You can configure your VPN to forward packets to your cluster. For details you should check other <code>Stackoverflow threads</code>:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/35738500/google-container-engine-and-vpn">Google Container Engine and VPN</a></li>
<li><a href="https://stackoverflow.com/questions/32618437/why-cant-i-access-my-kubernetes-service-via-its-ip/32619002#32619002">Why can't I access my Kubernetes service via its IP?</a></li>
</ul>
