skip to Main Content

I am trying depoly a replicaset of mongodb in my kind kubernetes.

Well, my first step is run thsi command:

helm upgrade --install mongodb bitnami/mongodb 
--set mongodb.global.storageClass=standard
--set mongodbRootPassword=root 
--set mongodbUsername=mongoUser 
--set mongodbPassword=mongoUser 
--set mongodbDatabase=articles 
--set mongodb.persistence.size=5Gi 
--set mongodb.service.type=NodePort 
--set mongodb.service.nodePort=30005 
--set mongodb.metrics.enabled=false 
--set replicaSet.enabled=true
--namespace replicaset-data

But I have tow questions:

  • How I can connect to this replicaSet?
  • The next question is about the persistent data. Y have a extraMounts defined y my kind kulster, but I not found the way to use it in this helm

Could anyone help my in this?

A lot of Thanks!

2

Answers


  1. Chosen as BEST ANSWER

    Well. I have finally a response for the questions... is not a definedly respose, but is a progress.

    All that I says here, is about binami/monogdb Helm Clart.

    Firstly, I thinks is better usea a values.yaml for deploy the helm; so, you can see all the available parameters for the helm. Here, you can see that if you deploy the helm in standalone mode, you can indicate the name of the PVC, so, yo can bindind your deployment with your pvc. However, you can see in the values.yaml, that in replicaset mode, you can't set this parameter (you can set anothers like the space, type...).

    By other hand, the url for conect to mongo, insde the kubernetes cluster is:

    mongodb://<user>:<password>@<service-name>.<namespace>:<port>/?authMechanism=DEFAULT&directConnection=true
    

    If you deploy mongo on standalone mode, the is by default "mongodb". If you deploy mongo on replicaset mode, the is by default "mongodb-headless".

    So, knowing that, is easy set your environment variable in your cliente service for connect to mongo service.

    So, the remain answer is ¿is a way to set the pvc in a replicaset mode? ¿how?


  2. How I can connect to this replicaSet?

    You can use the K8s service to connect with these replicas service type like LoadBalancer, Port-forward, using ingress

    The next question is about the persistent data. Y have a extraMounts
    defined y my kind kulster, but I not found the way to use it in this
    helm

    You can use the PV and PVC with the K8s cluster to persist the data of your database.

    Read more at : https://github.com/bitnami/charts/issues/3291

    Prameters : https://artifacthub.io/packages/helm/bitnami/mongodb#persistence-parameters

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search