-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to connect to GCP SQL when using --private-ip flag #2316
Comments
Just to add something I missed. SQL instance only accepts SSL connections |
Hi @mudasirmirza thanks for the great question! 😄 This appears to be a duplicate question of #1844 TLDR;
I'll repost the solution of the other issue here for clarity: Transitive VPC limitation: In your instance you have provisioned a Cloud SQL instance with PSA private IP from the default VPC (VPC B in image). Internally, Cloud SQL deploys the instance in its own managed VPC, the “Cloud SQL VPC”, VPC C and automatically peers it with the VPC you configured the instance with (VPC B). Any authorized Google Cloud resources in VPC B may route traffic to the Cloud SQL instances over private IP. However, if you have an additional separate VPC, VPC A, these Google Cloud resources will not be able to directly access your Cloud SQL resources over private IP through VPC B (intermediate VPC). Even if you’ve set up a peering connection between your VPC B and your VPC A ( your inactive peering), resources in VPC A will be unable to connect over private IP due to the nature of transitive VPC peering through private service access. We have a dedicated docs page "Connector your instance to multiple VPC" that provides a list of solutions around this transitivity issue. I would recommend configuring your instance to connect via Private Service Connect, this solution mitigates the entire transitive VPC issue and was designed with this exact use-case in mind. If you have any follow up questions please let me know. Have a great day 😄 |
Thanks for your quick and detailed response. The biggest limitation with PSC is that the instance is already present and is being used heavily which means I just can not make that change. I went through the links that your provided and the only method I think might work is using Cloud Router, but I am unable to find any example of that. It will be great if you can share an example of some scenarios to configure cloud router. Regards, |
@mudasirmirza The Cloud Router section has a "how-to" walkthrough of setting up two HA VPN gateways with Cloud Router, I would give it a look through and see if it meets your needs. |
@mudasirmirza It is worth pointing out and adding that on Nov. 15th the ability to configure an existing private IP (PSA) instance with a PSC IP will go into Public Preview. |
This is good to know. I will be trying out the HA VPN setup and see if that works out |
@mudasirmirza any luck getting a working setup? Let me know if I can assist in any other way 😄 |
Hi @jackwotherspoon , I tried to setup VPN but to no success. Not sure if it will work with my current setup. |
@mudasirmirza It is quite a complex setup to get working from my own experience. I'll keep you posted with the Public Preview launching next week for enabling PSC on a private IP (PSA) instance. It is definitely the easiest path forward 😄 |
Hi @jackwotherspoon, Please let me know if this feature has been release and if there is any documentation for this. I was trying to check this in the settings of the instance but unable to see anything. |
Question
When using Cloud SQL Proxy with the
--private-ip
flag to connect a MySQL instance hosted in a private IP setup, the connection fails inside a GKE pod. Without the--private-ip
flag, the proxy works fine over a public IP, but the private IP configuration fails to function as expected.The setup uses:
Logs when using
--private-ip
, for some reason, it connects to port 3307Below is the YAML manifest used to create the POD
GCP SQL instances is currently configured to use "Public IP" and "Private IP" and there is a list of IPs in the "authorized networks" which has the IP from which the call is being made.
Expected Behavior:
After doing all this, I am stuck and unable to make the connection.
Code
No response
Additional Details
No response
The text was updated successfully, but these errors were encountered: