无法使用代理

问题描述

我正在尝试使用cloudsql-proxy连接到我的Cloudsql实例。

        - name: cloudsql-proxy
          command:
            - /cloud_sql_proxy
            - -instances=$(project):europe-west2:$(DB_INSTANCE_NAME)=tcp:5432
            - -credential_file=/etc/secrets/google_credentials.json
          image: gcr.io/cloudsql-docker/gce-proxy:1.13

我遇到以下错误

-> Throttling refreshCfg(project:europe-west2:db): it was only called 1.006390387s ago
-> Couldn't connect to "project:europe-west2:db": Post https://www.googleapis.com/sql/v1beta4/projects/project/instances/db/createEphemeral?alt=json&prettyPrint=false: oauth2: cannot fetch token: Post https://oauth2.googleapis.com/token: read tcp 10.x.xx.4:59004->216.xx.xxx.202:443: read: connection reset by peer

错误消息是如此令人困惑,以至于它是网络问题或权限问题,我都无法理解。我已经检查了密钥和机密是否已正确安装且配置相同。 我试图查看Istio连接是否存在问题并创建了服务条目

---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
Metadata:
  name: google-apis
spec:
  hosts:
    - "www.googleapis.com"
  addresses:
    - 216.xx.xx.202
  ports:
    - name: https
      number: 443
      protocol: HTTPS
    - name: tcp
      number: 5432
      protocol: TCP
    - name: sql
      number: 3307
      protocol: TCP
  resolution: DNS
  location: MESH_EXTERNAL

---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
Metadata:
  name: cloudsql-instances
spec:
  hosts:
    - "*.googleapis.com"
    - "gkeconnect.googleapis.com"
    - "oauth2.googleapis.com"
  addresses:
    - 172.xx.xx.xx
    - 
  ports:
    - name: tcp
      number: 5432
      protocol: TCP
    - name: sql
      number: 3307
      protocol: TCP
  location: MESH_EXTERNAL

注意

  1. GKE群集是使用启用了出口和入口的terraform-google-module创建的
  2. GKE集群和Cloud sql实例都是私有的

类似地,我有一个查询->是否可以连接到已经在为另一个GKE集群提供服务的cloudsql实例(这个问题听起来很愚蠢,但我想不起其他任何东西了。)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)