使用 google-cloud-sdk 时,会注意到以下行为。对于第 2 点中的失败情况,目标是具有与下面提到的第 1 点相同的行为。这将确保 gcloud 在代理后面正常工作。有帮助吗?
服务帐户可以通过 Powershell 激活(如果在 Windows 代理设置中手动设置代理)。以下是成功案例的样子。
PS C:\Users\monica.bostina\Downloads\DLP1\Attended Framework> gcloud config list
[core]
account = [email protected]
disable_user_reporting = True
project = vf-grp-dlplt-dev-dlp01
Your active configuration is: [default]
PS C:\Users\monica.bostina\Downloads\DLP1\Attended Framework> gcloud auth activate-service-account --key-file="temporary-credentials.json"
已激活服务帐户凭据:[[电子邮件受保护]]
服务帐户无法通过 Powershell 激活(如果 Windows 代理设置中的“使用代理设置”为“开”且“手动代理设置”为“关”)。错误消息如下。
PS C:\Users\monica.bostina\Downloads\DLP1\Attended Framework> gcloud config list
[core]
account = [email protected]
disable_user_reporting = True
project = vf-grp-dlplt-dev-dlp01
Your active configuration is: [default]
PS C:\Users\monica.bostina\Downloads\DLP1\Attended Framework> gcloud auth activate-service-account --key-file="temporary-credentials.json"
ERROR: gcloud crashed (TransportError): HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000199D6670DF0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
我在处理 VPN 和代理的企业环境中工作。 在代理级别将以下 URL 列入白名单 --
https://accounts.google.com/o/oauth2/auth
https://oauth2.googleapis.com/token
https://www.googleapis.com/oauth2/v1/certs
https://www.googleapis.com/robot/v1/metadata/x509/vf-grp-XXXXXXXXXXXappspot.gserviceaccount.com
https://www.googleapis.com/auth/cloud-platform
也许手动代理配置有效,但在使用自动检测时,您会得到一个不适用于 Google Cloud 网址的 PAC 脚本。它也可能不适用于 shell/终端。
Google Cloud 在您可以信赖的应用程序内部拥有自己的代理配置,因此您无需在操作系统中手动设置代理配置。
我必须设置以下值(如文档记录):
gcloud config set proxy/type [PROXY_TYPE]
gcloud config set proxy/address [PROXY_IP_ADDRESS]
gcloud config set proxy/port [PROXY_PORT]
就我而言,因为我们还在代理上使用自定义 CA 证书,所以我还必须提取它们并将它们组合成一个可以在 Google Cloud 中信任的证书。
gcloud config set core/custom_ca_certs_file [PATH_TO_CUSTOM_CA]