gke-mongodb-demo icon indicating copy to clipboard operation
gke-mongodb-demo copied to clipboard

Exposing this for external services to use?

Open pvsousalima opened this issue 6 years ago • 4 comments

I am trying to expose it for external services to connect the replicated cluster, how do I make it via LoadBalancer?

pvsousalima avatar May 09 '18 23:05 pvsousalima

I have the same question. Any solutions?

PavelYarysh avatar Jul 26 '18 16:07 PavelYarysh

Yes, I was able to expose one service but I didn't use shards or anything, just a plain mongodb instance. I am still going to make more experiments on the matter so I can test it

pvsousalima avatar Jul 26 '18 16:07 pvsousalima

@pvsousalima that is cool. I am trying to expose it via LoadBalancer. I am not sure how to manage the secondary instances. Do I need to create services for all of them and manually choose the connection. Or something else.

PavelYarysh avatar Jul 26 '18 16:07 PavelYarysh

I had the same problem today when a developer needed to debug a problem in it but didn't have access to the cluster. For the life of me I couldn't find a way to expose the statefulset externally as apparently it's by design that a headless service won't be reacheable from outside the cluster. For a ad-hoc one-off debug session maybe exposing a single mongodb-0 pod (the primary, if possible) does the trick, but for more complex debugging/issues having a way to reach the main service IP of the statefulset and all its replicas would be ideal, so we could use the whole dynamics of master and slaves & data replication from outside the cluster.

caiobegotti avatar Jul 31 '18 19:07 caiobegotti