How to connect to nodes in multiregion cluster setup in GCP


Once we have the mutliregion cluster setup for GCP, can you give an example of how to connect to via a connection string to the SQL service ?

kubectl describe svc cockroachdb-public
Name: cockroachdb-public
Namespace: default
Type: ExternalName
External Name:
Session Affinity: None
VIGANAPA-M-2492:multicluster viganapa$

I am looking to do something like this:
sql -h host -d bank -u from the shell on my laptop.

(Tim O'Brien) #2

Hi @V4s,

Assuming an insecure cluster, you should be able to connect from the command line by running kubectl exec -it <podname> -- ./cockroach sql --insecure --host=cockroachdb-public. We have similar examples in our kubernetes orchestration docs. Does that help answer your question?


Thanks Tim,
My set up is a secure one. Yes, the docs give us a way to connect to SQL cmdline by launching a client pod inside the cluster.
I want to connect the SQL shell from my laptop as follows.

sql -h host -d bank -u --cert-dir=<>

Is there a way to connect to the cockroachDB containers from the laptop?