英文:
VPC Connector error while creating Cloud Function
问题
I am trying to create a Cloud Function in a GCP environment.
Am getting the error under 'CONNECTIONS' egress settings stating 'VPC connector is required'. In other GCP projects, this egress setting is set to None and it's working. Any help on what needs to be done?
I am not able to proceed to the next step in the wizard. I tried with various variations i.e. Cloud Storage trigger, pub/sub trigger/ https but the issue persists.
英文:
Am trying to create a Cloud Function in a GCP environment.
Am getting the error under 'CONNECTIONS' egress settings stating 'VPC connector is required'. In other gcp projects, this egress setting is sett to None and it's working. Any help on what needs to be done?
I am not able to proceed to the next step in the wizard. I tried with various variations i.e. Cloud Storage trigger, pub/sub trigger/ https but the issue persists.
答案1
得分: 1
以下是翻译的内容:
这个错误可能出现在以下两种情况下:
-
如果您的项目继承了组织策略“Require VPC Connector (Cloud Functions) - constraints/cloudfunctions.requireVPCConnector”。因此,Cloud Function 在创建时需要指定 Network 字段。这就是在其他 GCP 项目中,当出站设置设置为 None 时,它能够正常工作的原因。
要解决此问题,您可以修改此项目的组织策略值,允许成功创建 Cloud Function 而无需指定 Network 字段。请按照此官方文档进行检查并删除策略。
-
如果您尝试使用 Cloud Function 连接到跨多个项目的 Kubernetes API,那么只有位于节点所在位置的 VPC 才会被使用,VPC 中的任何授权网络都可以访问控制平面。这是因为您的集群的控制平面位于Google 拥有的项目中,并且可以通过 VPC 对等连接访问。附上由 Neil Kolban 撰写的博客供您额外参考。
请检查上述条件,如果问题仍然存在,请告诉我。
英文:
This error can occurred with two conditions mentioned below:
-
If your project has organization policy
Require VPC Connector (Cloud Functions) - constraints/cloudfunctions.requireVPCConnector
inherited. Therefore, the Cloud Function requires a Network field to be specified on the creation. That’s the reason in other GCP projects, when egress setting is set to None and it's working.To resolve your issue,you can modify the organization policy value for this project which will allow the Cloud Function to be successfully created without a Network field. Follow this official doc to check and remove the policy.
-
If you are trying to use the Cloud Function to connect to Kubernetes API which is across multiple projects then only the VPC is used where your nodes are located, and any authorized networks in the VPC will be able to access the control plane. This is due to the control plane for your cluster being located in a Google-owned project, and reachable through VPC peering. Attaching a blog written by Neil Kolban for your additional reference.
Check the above conditions and let me know if the issue still persists.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论