Thursday, October 25, 2018

[google-cloud-sql-discuss] Re: Postgres refuses connection when trying to use Proxy with Kubernetes

I changed the ports per Harmit's instructions. I also found that for some reason the credential files were not getting loaded into the proxy properly. So if you're running into those issues it is a good idea to check those issues.

After fixing both of those issues, it worked!! 

Thank you Harmit for your detailed answer!

On Thursday, October 25, 2018 at 2:07:58 PM UTC-7, Harmit Rishi (Cloud Platform Support) wrote:

Hello,


Considering the type of error you are receiving, it would be my recommendation to follow the troubleshooting steps on the GKE troubleshooting in here.


If the issue persists we can attempt the following as well:


-Verify scopes/permissions for your cluster by navigating from GCP>KE> Cluster>permissions> Cloud SQL should be "Enabled".


(Note: if you see Cloud SQL: Disabled then you can enable the API permission here.)


-You had mentioned that a docker image was built exposing port:5432. I would like to inform you that only your proxy port should be set to 5432.


(Note: When a cluster is created the default port for the proxy is 5432. Connection errors can occur if the same port is used for both the cluster and your proxy within the pod.)


Also, this forum is not intended for troubleshooting customer issues, so I'll recommend posting your issue on Stackoverflow forum


On Thursday, October 25, 2018 at 8:22:00 AM UTC-4, Nathan Berkowitz wrote:
Hi All,

I have an application written in python that streams tweets from Twitter into a PostGres database in Google Cloud Platform using SqlAlchemy. 

I built the docker image (exposing port 5432) and uploaded it to the container registry, and followed all of the steps to connect GKE to SQL in the "Connecting from GKE" guide. 

However, after following all of the steps and setting up the proxy, I keep getting the "connection refused" error from the database. 

Here are the things that I have checked:
  • Tested the script locally. If I use the public IP I set up for local connections, it works fine.
  • Re-built the docker image using the --no-cache flag to make sure my changes were actually implemented
  • Made sure that the Kubernetes Engine Service Agent had Admin access to Cloud SQL.
  • Changed the Host IP in my application from the DBs public IP to localhost, per the instructions.
  • Checked to make sure that the username/password were correct.
Any help you could offer would be greatly appreciated!

Best,
Nathan

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/214b9021-d065-4bcd-b3b5-069037890be7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment