Unable to install ReplicaSet onto k8s using Helm

Hi,

Currently we are trying to install mongodb on our k8s cluster using helm chart(bitnami/mongodb).
Mongo details ( repository: bitnami/mongodb, tag: 5.0.8-debian-10-r24)

We are pretty much using the standard values with replicaset architecture and 3 replicaCount. However the setup is not working. Normally I would expect the cluster to work right away with these settings however when we go into the nodes and run rs.status() from mongosh we are getting back “MongoServerError: no replset config has been received” error in each of the nodes.

Does anybody else having the same issue? Any help would be appreciated.

Thanks.

Most likely rs.initiate() and rs.add() was not executed.

Hey stevej.

Thanks for the reply. You are right. I am making some more way with rs.initiate and rs.add (although still havent been able to get it working yet. )

Normally I would expect the initial setup to just work when you specify the number of replicas in the helm chart values, however it only just starts up the pods it seems. After that setting up the replicaSet is still seems to be a manual operation. I am planning to do the replica setup with a post deployment script.

I will update this post if I manage to get this to work.

Cheers

1 Like

What are the new issues?

Hello stevej,

So I managed to get it working. The issue I was having turned out to be related to networking so not mongo related.

And to get it to work with the Helm chart I ended up doing the initialization manually in the initdbScripts. After adding this to the initdbScripts in the helm chart it is working now.

initdbScripts:
setup_replicaset_script.js : |
rs.add(“mongo-mongodb-0.mongo-mongodb-headless.svc.cluster.local:27017”)
rs.add(“mongo-mongodb-1.mongo-mongodb-headless.svc.cluster.local:27017”)
rs.add(“mongo-mongodb-2.mongo-mongodb-headless.svc.cluster.local:27017”)

Thanks a lot for the help.

Cheers

1 Like

By the way I added this into the values.yml file that I am passing in for the install, not the helm chart of course.