Mongo Db replication || Kubernetes

We are running two mongoDbs in same kubernetes cluster on different namespace, need to sync these mongodbs.

Tried mongosync but it is unsupported as we are using 5.x.x version of mongo.

Using mongodb replicaset we are able initiate rs.initiate(), but while adding the slave/another mongodb (i.e. rs.add(“hostname:port”) it is getting stuck and after couple of minutes throwing errors.

Initially I thought of connectivity issue but Using mongoshell I can remotely access both the databases. Both the databases exposed via kubernetes cluster-ip.

Please help.

It doesn’t mean these two mongodb servers can talk to each other. Did you verify this ?

Both mongoDb instances are running in kubernetes but in a different namespace, From one kubernetes mongoDB pod I can able to access another mongodb via mongoshell and vice-versa.

what is the error like?