Open jasonjei opened 8 years ago
Note: I've (finally) merged GoogleCloudPlatform/cloudsql-proxy#1
I've kept the order as 'network:host:post', though, so your example should be tcp:0.0.0.0:3306
. I also suggest that you mention the fact that it is important to ensure the firewall is configured such that only trusted entities can access that container's port. Opening up to 0.0.0.0 means that anything that can connect to that container/VM's port 3306 would be able to access your Cloud SQL Database.
The new CloudSQL Proxy tool can be installed on a docker image and run as a service in a container by broadcasting the port 3306 on address 0.0.0.0. Would this make the CloudSQL IP tool obsolete since you wouldn't need to manage IPs anymore and access CloudSQL through your CloudSQL proxy container? This seems desirable because there are no ACLs maintained.
Basically, I run a basic container with a folder called
/cloudsql
in the root, and copy thecloud_sql_proxy
binary into the root of the container. You may need to build a binary from GoogleCloudPlatform/cloudsql-proxy#1 or GoogleCloudPlatform/cloudsql-proxy#2 to get the ability to specify the listening address (current cloud_sql_proxy only listens to 127.0.0.1).My run.sh script for Dockerfile CMD assuming environmental variable CLOUDSQL_PATH=PROJECT_NAME:us-central1:DB_INSTANCE:
My Service:
My ReplicationController: