从容器引擎连接到 Google 云 SQL:无法解析云 sql 代理

Connecting to Google Cloud SQL from Container Engine: can't resolve cloud sql proxy

我正在尝试从节点应用程序连接到 Google 云 SQL,该节点应用程序位于 运行 由 Kubernetes 管理的 Google 容器引擎 pod 中。我已按照说明 here 创建云 SQL 代理。

当我 运行 应用程序时,我收到:

{
    "code": "ENOTFOUND",
    "errno": "ENOTFOUND",
    "syscall": "getaddrinfo",
    "hostname": "127.0.0.1:3306",
    "host": "127.0.0.1:3306",
    "port": 3306,
    "fatal": true
}

所以看起来代理无法解析。

我已经 运行 kubectl describe pods <pod_name> 并且代理看起来很健康:

cloudsql-proxy:
    Container ID:   docker://47dfb6d22d5e0924f0bb4e1df85220270b4f21e971228d03148fef6b3aad6c6c
    Image:      b.gcr.io/cloudsql-docker/gce-proxy:1.05
    Image ID:       docker://sha256:338793fcb60d519482682df9d6f88da99888ba69bc6da96b18a636e1a233e5ec
    Port:       
    Command:
      /cloud_sql_proxy
      --dir=/cloudsql
      -instances=touch-farm:asia-east1:api-staging=tcp:3306
      -credential_file=/secrets/cloudsql/credentials.json
    Requests:
      cpu:          100m
    State:          Running
      Started:          Sat, 01 Oct 2016 20:38:40 +1000
    Ready:          True
    Restart Count:      0
    Environment Variables:  <none>

对我来说唯一不寻常的是 Port 字段是空白的,但是上面引用的指南中没有说明在部署配置文件中公开端口。我也试过在配置文件中指定 3306 端口,但是尽管端口随后显示在 kubectl describe pods 输出中,节点仍然找不到代理。

我在这里错过了什么?为什么我无法解析代理?

编辑(更多信息)

来自 cloudsql-proxy 容器的日志:

2016-10-01T11:44:40.108529344Z 2016/10/01 11:44:40 Listening on 127.0.0.1:3306 for touch-farm:asia-east1:api-staging
2016-10-01T11:44:40.108561194Z 2016/10/01 11:44:40 Ready for new connections

您似乎将主机指定为 127.0.0.1:3306 而不是 127.0.0.1