Search code examples
google-cloud-platformgoogle-cloud-rungoogle-cloud-networkinggoogle-cloud-http-load-balancer

CloudRun can't make outbound http(s) requests - Timeout


I'm having a hard time debugging why cloudrun is not allowed to make outbound HTTP to the public internet.

My setup follows a simple Global loadbalancer (Classic) -> CloudRun, Using a custom VPC Network and a serverless VPC connector explained here:

https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#create-connector

I can reach my Cloudrun service just fine by hitting the URL in the browser, however, my server is making an HTTP request to a public endpoint which fails with a timeout.

I've also tested by hitting different public URLs (ex: Wikipedia) and the same error happens. So it is definitely an egress issue.

I've added a custom egress policy to see if that was the issue, (as shown below) but that didn't make any difference.

Egress

Here is my Entire Networking Configuration to make things easier to understand:

Network

name: virtual-applications Subnet Gateway: 10.7.10.0/28

Network

Firewall Rules

Firewall Rules

Note: I've also tried to change the "allow-internal" rule, to allow all (0.0.0.0/0) no difference.

Routes

Routes

VPC Peering

VPC Peering

VPC Connector

Connector

Any idea?


Solution

  • The Problem was that I needed to create a NAT gateway by assigning static IP

    Here is the guide: https://cloud.google.com/run/docs/configuring/static-outbound-ip#:~:text=By%20default%2C%20a%20Cloud%20Run%20service%20connects%20to,database%20or%20API%20using%20an%20IP%20address-based%20firewall.