googlearchive / k8s-service-catalog

[DEPRECATED] Commandline tool to manage Service Catalog lifecycle and GCP Service Broker atop Kubernetes Cluster
Apache License 2.0
69 stars 31 forks source link

Missing connection information in MySQL binding #215

Open arapulido opened 5 years ago

arapulido commented 5 years ago

I have created a MySQL instance using the GCP k8s service broker and a binding for it.

The only output for the binding I get is connectionName and serviceAccount.

Is there anything missing? (i.e. host). How am I supposed to use those so my K8s app can connect to it?

mszostok commented 5 years ago

Hi @arapulido, some time ago I tested GCP broker. And you are getting correct information from binding action. You need to use the cloudsql-proxy configured with given connectionName and serviceAccount. The cloudsql-proxy need to be executed locally on your Pod, so another process can reach the database by calling proxy. If you are programming in Go then you can use that library directly in your code.

Here is how it used in deployment: https://github.com/GoogleCloudPlatform/kubernetes-engine-samples/blob/master/service-catalog/cloud-sql-mysql/manifests/user-deployment.yaml#L46-L66

And here you find the complete tutorial for cloud-sql-mysql.