<p>I have a pod running on Google Cloud Kubernetes and I have a MongoDB cluster running on Atlas.
The issue is quite simple:</p>

<p><strong>If I allow IP from ANYWHERE on Atlas MongoDB, I can connect. 
If I add the IP of the pod (so not from ANYWHERE anymore), it doesn't work.</strong></p>

<p>I also tried locally and from a docker running locally as well, it works.</p>

<p>I got the IP (YY.YYY.YYY.YY) of my pod using:</p>

<pre><code>MacBook-Pro-de-Emixam23:plop-service emixam23$ kubectl get services
NAME           TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)                           AGE
polop-service  LoadBalancer   XX.XX.X.XXX   YY.YYY.YYY.YY   ZZZZZ:32633/TCP,ZZZZZ:32712/TCP   172m
kubernetes     ClusterIP      XX.X.X.X      &lt;none&gt;          443/TCP                           3h24m
</code></pre>

<p>But by the behavior I get.. I feel like this EXTERNAL-IP isn't the IP from where my requests are sent from.</p>

<p>Can anyone explain to me what can be the issue?</p>

Emixam23
<p>The IP exposed to Mongo Atlas should be Internet accessible IP (or called it, public IP). </p>

<p>Normally it should be the net gateway IPs (or proxy server's IPs, if you go with proxy). </p>

<p>One quick way to check the IP by running below command in pods</p>

<pre><code>curl ifconfig.me
</code></pre>

<p>If your pod doesn't support this command, you can <code>kubectl exec -ti &lt;pod_name&gt; -- sh</code> in it and install this command.</p>

<p><strong>Remember</strong>: normally the IPs are not only one, there should be 3 or more public facing IPs via net gateway, you need find them all and add to Mongo Atlas whitelists</p>
