Hey y'all
I'm going to connect from the instance in Project-A(custom VPC) with CloudSQL Postgres in Project-B(default VPC). Documentation says that I need to peer these two VPC. The peering status in the "Active" state. In Project-A I also have cloudsql_auth_proxy. Once I execute cloudsql_auth_proxy, I get this:
root@cloudsql-auth-proxy:~# ./cloud_sql_proxy -instances=projectB:us-west1:postgres=tcp:0.0.0.0:5432
2022/12/29 16:46:59 current FDs rlimit set to 1048576, wanted limit is 8500. Nothing to do here.
2022/12/29 16:47:01 Listening on 0.0.0.0:5432 for -instances=projectB:us-west1:postgres=tcp:0.0.0.0:5432
2022/12/29 16:47:01 Ready for new connections
2022/12/29 16:47:01 Generated RSA key in 244.541948ms
When I try to connect to the cloudsql_proxy like this psql -h xxx.xxx.xxx.xxx -p 5432 -U proxyuser -d postgres it hangs.
The output of cloudsql_auth_proxy looks like this:
2022/12/29 16:48:00 New connection for "-instances=projectB:us-west1:postgres"
2022/12/29 16:48:00 refreshing ephemeral certificate for instance -instances=projectB:us-west1:postgres
2022/12/29 16:48:00 Scheduling refresh of ephemeral certificate in 55m0s
: dial tcp 10.35.144.3:3307: connect: connection timed out
The final goal is connecting Datastream(ProjectA) with CloudSQL(ProjectB)
Solved! Go to Solution.
./cloud_sql_proxy -instances=projectB:region:instance_name=tcp:0.0.0.0:5432
psql -h EXTERNAL_IP_ADDRESS -p 5432 -U USERNAME -d DATABASE_NAME
./cloud_sql_proxy -instances=projectB:region:instance_name=tcp:0.0.0.0:5432
psql -h EXTERNAL_IP_ADDRESS -p 5432 -U USERNAME -d DATABASE_NAME
@christianpaula How to get it working with private_ip using CloudSQLProxy? I appreciate any help.
CloudSQL MySQL Instance is in custom VPC in ProjectB with Public IP disabled.
GKE running CloudSqlProxy shared service in 'default' VPC in ProjectA.
VPC peering is active in ProjectA and ProjectB.
CloudSqlAuthProxy running in ProjectA using KSA Workload Identity to access CloudSQL in ProjectB.
Deployed CloudSQLProxy replicaSet workload and supplied --private-ip argument. But the CloudSQLProxy is not able to connect to the CloudSQL instance. Everything works when Public IP is enabled.