<p>I am trying to connect to a MongoDB instance which is running on an external server from a pod running in a k8s cluster. I do have a VPC peering setup between two VPCs and I am perfectly able to connect to MongoDB server from nodes but when I try from a running pod, it fails. On trying traceroute, I think the private IP is not being resolved outside of the pod network.</p>

<p>Is there anything else which needs to be configured on pod networking side?</p>

Shantanu Deshpande
<p>Taking a wild guess here, I believe your <a href="https://kubernetes.io/docs/setup/scratch/#network" rel="nofollow noreferrer">podCidr</a> is conflicting with one of the Cidrs on your VPC. For example:</p>

<pre><code>192.168.0.0/16 &lt;podCidr) -&gt;  192.168.1.0/24 (VPC cidr)
# Pod is thinking it needs to talk to another pod in the cluster
# instead of a server
</code></pre>

<p>You can see your podCidr with this command (<code>clusterCIDR</code> field):</p>

<pre><code>$ kubectl -n kube-system get cm kube-proxy -o=yaml
</code></pre>

<p>Another aspect where things could be misconfigured could be your overlay network, where the pods are not getting pod IP address.</p>
