Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Sql in gke container proxy deny request

Hello, I have one deployment with the cloud sql proxy container and one service to expose the port 5432 but when I try to connect the svc I have this issue.

 

 

root@ubuntu:/# psql "dbname=test host=svc.ns.svc.cluster.local user=test password=test port=5432"
psql: error: connection to server at "svc.ns.svc.cluster.local" (10.96.164.54), port 5432 failed: received invalid response to SSL negotiation: H

 

 My cloud proxy container definition inside my deployment.

 

 

      - command:
        - /cloud_sql_proxy
        - -instances=project:region:instance=tcp:0.0.0.0:5432
        - -credential_file=/var/secrets/google/key.json
        - -ip_address_types=PRIVATE
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
        image: gcr.io/cloudsql-docker/gce-proxy:1.17
        imagePullPolicy: IfNotPresent
        name: cloud-sql-proxy
        ports:
        - containerPort: 5432
          name: http-sql
          protocol: TCP

 

  my svc:

 

  - name: http-sql
    port: 5432
    protocol: TCP
    targetPort: 5432

 

 

Are you familiar with this issue ?

Solved Solved
0 2 689
1 ACCEPTED SOLUTION

Hey I found a better and clean approach since my sql instance is a private instance in the same vpc my cluster is, I can use the private ip to connect to the db. Thanks for you help.

View solution in original post

2 REPLIES 2

What DB engine are you using for SQL? I found this post in Stack Overflow, the issue in the post is similar to yours, and the answers and recommendations could be useful to solve your doubt. Additionally to that, did you already check this public documentation related to:

It might be useful to you to read the articles related to your concern.

Hey I found a better and clean approach since my sql instance is a private instance in the same vpc my cluster is, I can use the private ip to connect to the db. Thanks for you help.

Top Labels in this Space