I have deployed bitnami's Mongodb helm chart in the replicaset mode on a K8s cluster, using this minimal config (for now):
architecture: replicaset
auth:
enabled: false
Now I have two replicas (one primary and one secondary, allegedly) and an arbiter (no data, just voting rights). Additionally, I got two services: appname-mongodb-headless
, appname-mongodb-arbiter-headless
. However, the MongoDB docs specify the connection string in case of replicaset installations as mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myRepl
.
I can use mongodb://appname-mongodb-headless:27017
to connect to the db, but is it the "real experience" (i.e. highly available, etc)?
- Do I need to specify the replicaset name (as in the example) and how do I find out what it is?
- If the current services are enough, do I need to include the arbiter in the connection string?
- Or should I create separate services for each replica and build the recommended connection string?
externalAccess: enabled: true autoDiscovery: enabled: true
- I will eventually enable authentication after sorting out this part of the connection. What is this
replicaSetKey
("Key used for authentication in the replicaset"), and where do I use it?
I found this similar question. It is for another chart, but it suggests me that some combination of the headless services should be enough. Nonetheless, it doesn't answer all aspects of my question.