Kubernetes pods can't connect to MySQL

74 views
Skip to first unread message

Christophe Deschervois

unread,
Jan 18, 2019, 12:11:49 PM1/18/19
to Google Cloud SQL discuss
HI all,

I am new to  google cloud ( coming from AWS) and I am trying to get my Kubernetes pods(a java app) to  connect  to a mysql instance I have created using a private IP  as it seems to be the easiest/recommended way...  (I was able to connect directly to the DB using the web-console) . but the java app keeps getting connection refused.


I looked at https://cloud.google.com/sql/docs/mysql/private-ip but I was not able to make anything of it. I must say the process is not very clear nor well documented. 

I believe this is a very basic requirement, are there clear steps anywhere on how to accomplish this?

Thanks,
Christophe.

amit...@google.com

unread,
Jan 28, 2019, 12:11:42 PM1/28/19
to google-cloud...@googlegroups.com

Hello Christophe,


If you get a ‘SQLException: Connection refused’ then it seems like DB isn't reachable at all. Could you please check if you can reach out to the IP from your pods? If you get anything else in the error, please provide the screenshot of the error attached with this post removing all sensitive information.


I have found this documentation which explains how to connect to Cloud SQL from External Applications. I would recommend to check this and try to establish a connection from your java application using the instructions.


[1] https://cloud.google.com/sql/docs/mysql/connect-external-app#languages


Reply all
Reply to author
Forward
0 new messages