小编Sar*_*ras的帖子

如何使用 sourceIP 在公共 GKE 集群 pod 中使用云 NAT

根据 Cloud NAT 上的 GCP 文档,

常规(非私有)GKE 集群为每个节点分配一个外部 IP 地址,因此此类集群无法使用 Cloud NAT 从节点的主要接口发送数据包。如果 Pod 发送源 IP 地址设置为 Pod IP 的数据包,它们仍然可以使用 Cloud NAT

问题:如何配置 pod 以在向某些外部服务发送数据包时将源 IP 设置为 pod IP?

nat google-cloud-platform google-kubernetes-engine

7
推荐指数
1
解决办法
1391
查看次数

使用服务帐户从 python 调用 Google Cloud Function 进行身份验证

我有一个触发器类型设置为 HTTP 的云函数,还有一个有权调用云函数的服务帐户。我想从 python 脚本调用云函数。我正在使用以下脚本来调用该函数:

from google.oauth2 import service_account
from google.auth.transport.urllib3 import AuthorizedHttp

credentials = service_account.Credentials.from_service_account_file('/path/to/service-account-credentials.json')

scoped_credentials = credentials.with_scopes(['https://www.googleapis.com/auth/cloud-platform'])

authed_http = AuthorizedHttp(scoped_credentials)

response = authed_http.request('GET', 'https://test-123456.cloudfunctions.net/my-cloud-function')

print(response.status)
Run Code Online (Sandbox Code Playgroud)

我收到 Unauthorized (401) 错误作为响应。这是正确的调用方式吗?

python http-authentication service-accounts google-cloud-platform google-cloud-functions

4
推荐指数
1
解决办法
733
查看次数