方案
Springboot REST api,配置如下:
详情
与link中描述的一样,我创建了一个代理,以便我的api可以连接到Cloud SQL数据库(Postgres),但是,我正面临下面的例外。
异常
无法创建池的初始连接
我的POD:
containers:
- env:
- name: DS_USR
valueFrom:
secretKeyRef:
key: username
name: cloudsql-db-credentials
- name: DS_PWD
valueFrom:
secretKeyRef:
key: password
name: cloudsql-db-credentials
- name: DS_URL
valueFrom:
configMapKeyRef:
name: transaction-api-map
key: ds-url
...
- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.11
command: ["/cloud_sql_proxy",
"-instances=gcr.io/myproject/transaction-api:0.0.1=tcp:5432",
"-credential_file=/secrets/cloudsql/credentials.json"]
volumeMounts:
- name: cloudsql-instance-credentials
mountPath: /secrets/cloudsql
readOnly: true
# [END proxy_container]
# [START volumes]
volumes:
- name: cloudsql-instance-credentials
secret:
secretName: cloudsql-instance-credentials
你们对发生了什么有什么想法吗?