Problem MongoDB Community Kubernetes Operator

95 Views Asked by At

After deploying a mongo base on a local eks cluster on carbon using mongodb-kubernetes-operator

The replicas, the ssl connection inside the cluster works correctly, but to connect out of cluster using a client, in our case MongoCompass and Mongo.Driver (c#).

directconnection true - success

It connects without problem but only using the DirectConnection but the limitation using this parameter is that we can't define if our connection string is pointing to the primary.

If we remove the DirectConnection the error I get is: getaddrinfo ENOTFOUND mongo-1.mongo.gx-common-mongo.svc.cluster.local

directconnection false - error

even after defining the name of the replica.

Other alternatives that we explored was to expose 3 services to expose the 3 pods and thus to have the primary and the 2 secondary ones, but the mongoDriver does not manage to make the change in automatic of port to look for which is the primary one.

Another alternative was to add logic for when you get the error about not being the primary pod we change it, but it generated inconsistency in data.

Am I missing some extra config configuring it on-prem?

0

There are 0 best solutions below