【发布时间】:2021-05-06 06:48:36
【问题描述】:
我正在按照 Google Cloud Platform 的指南使用 Cloud SQL 代理和公共 IP 地址 (https://cloud.google.com/sql/docs/postgres/connect-kubernetes-engine) 通过 GKE 集群连接到 Cloud SQL 实例。但是,在尝试部署我的应用程序后,我的容器日志中出现以下错误。
{ Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432 }
后面跟着错误信息
2021/02/01 05:35:31 the default Compute Engine service account is not configured with sufficient permissions to access the Cloud SQL API from this VM. Please create a new VM with Cloud SQL access (scope) enabled under "Identity and API access". Alternatively, create a new "service account key" and specify it using the -credential_file parameter
此外(我假设相关)当我检查集群中节点的计算引擎时,我看到 Cloud SQL Cloud API 访问范围被禁用。有没有办法启用它?
我知道有多种方法可以通过 GKE 集群连接到 Cloud SQL 实例,但是,我想通过凭据文件使用工作负载身份。
【问题讨论】:
标签: google-cloud-platform google-kubernetes-engine google-cloud-sql service-accounts cloud-sql-proxy