Search code examples
google-cloud-platformgoogle-compute-enginegoogle-cloud-sql

No route to host when i try connect to cloud sql, but only on CONTAINER-OPTIMIZED OS


I create instances in Compute Engine and depending on which system I choose, I get different messages when I try to connect to cloud sql. All settings are the same for both machines and the zone.

On CONTAINER-OPTIMIZED OS, the command "nc -vz XXX 5432" running on host (not in docker) returns:

XXX: inverse host lookup failed:
(UNKNOWN) [XXX] 5432 (postgresql): No route to host

On debian linux it's ok

XXX: inverse host lookup failed: Unknown host
(UNKNOWN) [XXX] 5432 (postgresql) open

I tried to change iptables but after allowing everything, it's still the same message.

EDIT

Problem reason:

Private address cloud sql is 172.17.2xx.x, docker generate also private network on os with address 172.17.xxx.x and mask /16, so when i try connect i cant because system use docker network.

What is the best solution without changing the os configuration?


Solution

  • I created new network in cloud and now cloud sql have ip from other unconflicted pool.