0

while trying to connect to my cloudsql instance I am getting this error

{
errorno: "ETIMEDOUT",
code: "ETIMEDOUT",
syscall: "connect",
fatal: true
}

this is the log from my cloudsqlproxy container

2020/06/09 15:53:04 current FDs rlimit set to 1048576, wanted limit is 8500. Nothing to do here.
2020/06/09 15:53:04 using credential file for authentication; email=lion-db@estatelion-test-275318.iam.gserviceaccount.com
2020/06/09 15:53:04 Listening on 127.0.0.1:3306 for estatelion-test-275318:us-central1:estatelion
2020/06/09 15:53:04 Ready for new connections

but my nodejs application is unable to connect to it

const connection = mysql.createPool({
    connectionLimit: 10,
    host: config.get("database").host, // localhost
    user: config.get("database").user, // cloud proxy user for my cloudsql instance
    password: config.get("database").password, // password
    database: config.get("database").db_name, // database 
});
Hoppo
  • 1,130
  • 1
  • 13
  • 32
  • Can you verify if your service-account-key.json has permission to read data from cloudsql? – ARINDAM BANERJEE Jun 09 '20 at 18:40
  • Are you connecting them through the private IP? I ask this because this seems to be a network issue which. Also, have you taken a look to the preconditions over [here](https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine#before_you_begin)? – rsalinas Jun 10 '20 at 10:44
  • @ARINDAMBANERJEE service-account-key.json file has all the required permission to access the database, infact its working fine on my docker-for-desktop cluster with same key file and credentials. – Amit Sharma Jun 10 '20 at 18:09
  • @rsalinas no I am not connecting through private IP, is private IP required for cloudsqlproxy to work? – Amit Sharma Jun 10 '20 at 18:10

1 Answers1

0

Well I found the solution to this I just updated the Cluster version to 1.15.11-gke.15 from 1.14.* (I dont remember the rest ) and it worked fine.

I think there is some bug in the default GKE version of the deployment.

Thanks Everyone for your gracious time and effort. :-)