我正在尝试为我们的 Cloud Run 实例分配一个外部静态 IP 地址,以便我可以将其与 websockets 一起使用(我读过需要静态 IP 才能工作,而不是自指定/负载平衡的 GCloud)应用域名)。常规 URL 可以访问,但静态 IP 只是挂起。
我主要尝试遵循本指南: https ://cloud.google.com/run/docs/configuring/static-outbound-ip
我不完全确定外部IP如何路由到Cloud Run实例,因为它是一个自我管理的实例(即它上面没有私有IP地址),但假设其他部分正在解决这个问题。 。
gcloud compute routers create cloud-run-router --network=default --region=us-central1
gcloud compute addresses create cloud-run --region=us-central1
gcloud compute networks subnets create cloud-run-subnet --range=10.20.0.0/28 --network=default --region=us-central1
gcloud beta compute networks vpc-access connectors create cloud-run-sub-conn --subnet-project=project-name --subnet=cloud-run-subnet --region=us-central1
gcloud compute routers nats create cloud-run-nat --router=cloud-run-router --region=us-central1 --nat-custom-subnet-ip-ranges=cloud-run-subnet --nat-external-ip-pool=cloud-run