<p>I am new to Google Cloud Platform and the following context:</p>

<p>I have a Compute Engine VM running as a MongoDB server and a Compute Engine VM running as a NodeJS server already with Docker. Then the NodeJS application connects to Mongo via the default VPC internal IP. Now, I'm trying to migrate the NodeJS application to Google Kubernetes Engine, but I can't connect to the MongoDB server when I deploy the NodeJS application Docker image to the cluster.</p>

<p>All services like GCE and GKE are in the same region (us-east-1).</p>

<p>I did a hard test accessing a kubernetes cluster node via SSH and deploying a simple MongoDB Docker image and trying to connect to the remote MongoDB server via command line, but the problem is the same, time out when trying to connect.</p>

<p>I have also checked the firewall settings on GCP as well as the <code>bindIp</code> setting on the MongoDB server and it has no blocking on that.</p>

<p>Does anyone know what may be happening? Thank you very much.</p>

<p>In my case traffic from GKE to GCE VM was blocked by Google Firewall even thou both are in the same network (default).</p>
<p>I had to whitelist cluster pod network listed in cluster details:</p>
<p><code>Pod address range  10.8.0.0/14</code></p>
<p><a href="https://console.cloud.google.com/kubernetes/list" rel="noreferrer">https://console.cloud.google.com/kubernetes/list</a>
<a href="https://i.stack.imgur.com/EpnjW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EpnjW.png" alt="enter image description here" /></a></p>
<p><a href="https://console.cloud.google.com/networking/firewalls/list" rel="noreferrer">https://console.cloud.google.com/networking/firewalls/list</a></p>
<p><a href="https://i.stack.imgur.com/s8pTX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s8pTX.png" alt="firewall" /></a></p>
