Details
-
Bug
-
Status: Done
-
Medium
-
Resolution: Fixed
-
1.14.0
-
None
-
None
-
Yes
-
Yes
-
Yes
Description
In 1.14.0 of the operator we changed the way how we configure replica set - now it relies on cluster FQDNs: https://jira.percona.com/browse/K8SPSMDB-867
It is a good move and something that Mongo recommends.
The problem
This change created a problem, that if I expose a single replica set through a LoadBalancer, I can't connect to it anymore getting the following error:
$ mongosh 'mongodb://databaseAdmin:[email protected]:27017,35.226.148.87:27017,35.232.216.202:27017/?replicaSet=rs0&authSource=admin&tls=false' Current Mongosh Log ID: 6464cc5ae2927bbfc24e542d Connecting to: mongodb://<credentials>@35.202.76.124:27017,35.226.148.87:27017,35.232.216.202:27017/?replicaSet=rs0&authSource=admin&tls=false&appName=mongosh+1.8.2 MongoNetworkError: getaddrinfo ENOTFOUND my-cluster-name-rs0-1.my-cluster-name-rs0.test.svc.cluster.local
This is understandable, as the replica set and mongo does not know anything about load balancer public IP-addresses.
At the same time it is still possible to connect to the database through a single IP:
$ mongosh 'mongodb://databaseAdmin:[email protected]:27017/?authSource=admin&tls=false' Current Mongosh Log ID: 6464cd3ba20966b7677007a2 Connecting to: mongodb://<credentials>@35.226.148.87:27017/?authSource=admin&tls=false&directConnection=true&appName=mongosh+1.8.2 Using MongoDB: 6.0.4-3 Using Mongosh: 1.8.2
Workaround
The user can go back to old behavior via clusterServiceDNSMode if needed.
For the future, we might need to look into SplitHorizon.