Exposing replica set outside Kubernetes

I am using MongoDB Enterprise Operator for deploying MongoDB into Kubernetes. Till now I have successfully deployed the database but I am getting problems in exposing it outside kubernetes.

I am following this doc: https://docs.mongodb.com/kubernetes-operator/master/tutorial/connect-from-outside-k8s/
A/c to the doc, we have to expose each pod as NodePort and connect through replicaSetHorizons. But this requires that the k8s worker nodes have an external IP which is not available in my case.

Is there are other ways to expose the replicaset?



You can use a load-balancer service; one for each replicaset.

there should be some way to expose each pod to the outside. May be continuing the idea of @Eric_Faure you can try creating a LB instance for each of the pod in the replica set?

@Anton_Lisovenko, can you please elaborate a bit more on what you mean by a load balancer for replica set ? Assume this is going to be a NLB/TCP and I think this is a very common scenario for prod deployments.

Any reason that this is not documented and provided in the current documentation ?

The official docs recommend the use of nodeports.