vzu*_*urd 1 google-compute-engine google-cloud-platform google-vpc google-api-gateway
因此,我正在为在计算引擎上运行的应用程序设置 API 网关。由于我找不到任何有关如何在 API 引擎上配置计算引擎的文档,因此我使用内部 DNS 创建了以下配置。在此输入链接描述
swagger: "2.0"
info:
title: API Endpoints
description: API Endpoints
version: 1.0.1
schemes:
- https
produces:
- application/json
paths:
/indexes:
get:
summary: Return Search Indexes
operationId: searchIndexes
x-google-backend:
address: http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes
path_translation: APPEND_PATH_TO_ADDRESS
responses:
"200":
description: A successful response
schema:
type: string
"403":
description: Failed to authenticate
Run Code Online (Sandbox Code Playgroud)
当我使用gcloud部署配置时,出现以下错误
等待为 API [my-api] 创建 API 配置 [my-api-config-v6]...失败。
错误:(gcloud.beta.api-gateway.api-configs.create)等待服务配置创建:后端 URL“http://my_internal_dns_for_compute_engine.c.myproject.internal/indexes”被禁止:无法将请求路由到内部地址。
所以看起来内部 DNS 不受支持(显然)。
我的计算引擎实例只能通过 VPC 网络访问。如何将我的 api 网关连接到 VPC 网络以及如何通过它访问我的计算引擎?
今天,你无法实现这一目标。您的 API 网关是无服务器服务,您无法在其上插入无服务器 VPC 连接器。我已经与 Google 讨论过这个问题(因为这与 Cloud Scheduler、Cloud Task 和 PubSub 推送订阅等存在同样的问题),并且很快就会发生一些事情。敬请关注!!
无论如何,现在要解决您的问题,您有两种解决方案(至少,一种确定,一种要测试)
编辑1
我已经测试了第二个解决方案,它适用于内部 IP(以及部署了 ESPv2 的 Cloud Run Endpoint 服务上的无服务器 VPC 连接器),而不是内部 DNS 名称。
归档时间: |
|
查看次数: |
2810 次 |
最近记录: |