Install MongoDB on Kubernetes using bitnami Charts


I am trying to install MongoDB using bitnami charts. Running into authentication error between arbiter and mongodb replicatset. Would appreciate any pointers or links to docs that walks through the process.
Using the following chart:

- name: mongodb
  version: "13.6.2"

Values.yaml file:

resources: &resources
    cpu: 100m
    memory: 500Mi
    cpu: 100m
    memory: 100Mi

  architecture: replicaset
    enableLocalhostAuthBypass: true
    existingSecret: test-mongodb
    databases: [test-db1]
    usernames: [test-user1]
  replicaSetName: test-mongodb
  directoryPerDB: true
  resources: *resources
    storageClass: encrypted-gp2
    size: 20Gi
    create: true
  labels: &labels
    app: test-mongodb
    component: db
  podAnnotations: "false"
  podLabels: *labels
    resources: *resources
    labels: *labels
    podLabels: *labels
    podAnnotations: "false"
    enabled: true
    resources: *resources
      additionalLabels: *labels

K8s secet:

mongodb-passwords:        70 bytes
mongodb-replica-set-key:  668 bytes
mongodb-root-password:    68 bytes

I am getting the following error in arbiter-0:

MongoServerError: Authentication failed.

And the following error in mongodb-0:

{"msg":"Supported SASL mechanisms requested for unknown user","attr":{"user":{"user":"root","db":"admin"}}}
{"msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-256","speculative":true,"principalName":"root","authenticationDatabase":"admin","remote":"","extraInfo":{},"error":"UserNotFound: Could not find user \"root\" for db \"admin\""}}
{"msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","speculative":false,"principalName":"root","authenticationDatabase":"admin","remote":"","extraInfo":{},"error":"UserNotFound: Could not find user \"root\" for db \"admin\""}}

Can someone please help.

Thank you, Ahmed

Could the issue be the default DBs are not created, hence authentication is failng?

Hi @A_A11 and welcome to the MongoDB Community forum!!

The currect version you are using seems to be old while the latest version of the bitnami is 13.9.2, hence firstly would recommend you to upgrade to the latest version.
In addition, we do not have the right expertise and the ownership for the same, I would recommend you using the Bitnami Support is the issue persists.

However, Yes, it appears to be an authentication issue as the arbiter is trying to connect to db using the root user name which has not been defined but the admin, local, config databases are created by default as a part of the deployment process.

Please consider looking at the documentation for create user for further information.

However, if you still encounter any issue after creating the user on the admin database, please share the referred documentation for deployment with the relevant yaml files to test it in my local environment.

You can also refer to the Bitnami documentation to more details.

Let us know if you have any further questions.

Best Regards