Hey
I’m trying to automate deployment of mongodb, but i keep running around i cockles regarding replicasets.
If i deploy 3 instances using replicaset and and 3 nodes using localhostnames
I then expose those using traefic to add TLS and route 3 host names into each of the 3 internal host.
But no matter what i do it keep forcing my client to try and connect to the INTERAL host names
If i try and configure the replicaset using the external host names, it keeps failing with an error similar to “host not in host list” … I assume this id due to
.admin().command({ replSetReconfig: rsConfig, force: force }, {})
does not know how to connect using TLS
If i add the external domains to --bind_ip … mongodb crashes with an error similar to “refuses to listen to address” … From what i could understand it’s simply resolving the host name and try to listen to the external IP witch ofc will never work …
I then tried “hacking” it using the guide from https://www.mongodb.com/docs/manual/tutorial/change-hostnames-in-a-replica-set/ by updating db.system.replset but then mongod goes into a weird state when it no longer things it’s part of the replica set, and data is not replicated.
So how do i make replicasets stop sending internal host names OR tell the replicaset to use TLS when validating the config ?
And no, assigning public IP’s to each host is not an option.
And only publishing “the master” is not an option, since ( as far as i know ) there is no way for kubernetes to know what host is the primary at any given moment