Go app + Hosted GKE cockroachdb cluster on GCP


Just checking if there is a guide to deploy a go app to a Hosted GKE cockroachdb cluster on GCP that has been setup using this awesome guide.

To provide some context, we have a local machine dev setup - go web app talking to a 3 node secure cluster running locally.

The connection string looks like this for the local setup: sql.Open(“postgres”, " postgresql://user@localhost:26257/ceres?sslmode=verify-full…")

We want to take our local setup to GCP and are looking for an easy to use guide.


Hey @batman,

What guidance are you looking for specifically? How to set up the cluster so that it can be connected to remotely? How to migrate the data from a local cluster to a remote one? Something else?

Hey @tim-o,

Basically, we loved the docs and followed it to build a go web app.

We used this to start a local cluster.

We used this as a starting point to build a secure go web-app.

Then we use the hosted GKE guide to take the local DB to GCP.

Now, we want to take the go web-app to GCP and are looking for a good guide to do it.

I am new to Docker, Kubernetes, GCP and we basically used your awesome guides to get to where we are today. The last step is to simply take the local web-app to GCP/GKE. I created a docker container image using this guide. I changed the connection string in the app but can’t get it to work. Obviously I am missing a step or some detail.

Also, is it best practice to connect to a GKE cluster remotely? How can it be done so that web-app can securely connect to a remote cluster?

Edit: Another thing I tried today was to create a new cluster, deploy the docker image to the cluster and used example-app-secure.yaml to deploy a 3 node web server. However, I ran into this error: error connecting to the database: dial tcp: lookup cockroachdb-public on x.x.x.x: no such host


Hey @batman,

I think we have a draft document that might help you: take a look here and let me know if that addresses your use case.

Hey @tim-o,

I have been looking at that guide and the one here for a few days now and I finally got it to work.

I learnt a lot about Kubernetes, Docker and GCP and am happy with progress so far.

I will see if I can come up with a sample git hub repository for a full GKE cluster than runs both Cockroach DB, go web-app and how to go about deploying it to GCP. I think it may help other beginners like myself.

Thanks for all the help.


My pleasure, @batman! We’re always looking for suggestions for improvement, so if you come up with the github feel free to share and we can see how to include in documentation.