Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/mongodb] Custom databases not getting created #15151

Closed
desgith opened this issue Feb 25, 2023 · 13 comments
Closed

[bitnami/mongodb] Custom databases not getting created #15151

desgith opened this issue Feb 25, 2023 · 13 comments
Labels
mongodb solved stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@desgith
Copy link

desgith commented Feb 25, 2023

Name and Version

mongodb-13.6.7

What architecture are you using?

None

What steps will reproduce the bug?

helm.exe install mongodb . -n mongo

Are you using any custom parameters or values?

  usernames: [mycontext]
  passwords: [context]
  databases: [mynewdb]

What is the expected behavior?

mongosh admin --host "mongodb-0.mongodb-headless.m.svc.cluster.local:27017,mongodb-1.mongodb-headless.m.svc.cluster.local:27017" --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD

The above command should login and

show dbs

should show me mynewdb

What do you see instead?

rs0 [primary] admin> show dbs
admin   140.00 KiB
config  184.00 KiB
local   620.00 KiB

mynewdb is missing

Additional information

Am i doing anything wrong in this command or my understanding is wrong? .Values.auth.databases create new DBs or should i do something else to make it work

@desgith desgith added the tech-issues The user has a technical issue about an application label Feb 25, 2023
@github-actions github-actions bot added the triage Triage is needed label Feb 25, 2023
@javsalgar javsalgar changed the title Custom databases not getting created [bitnami/mongodb] Custom databases not getting created Feb 27, 2023
@javsalgar
Copy link
Contributor

Hi!

Could you share the logs of the containers to see if there's an any error?

@github-actions github-actions bot added in-progress and removed triage Triage is needed labels Feb 27, 2023
@desgith
Copy link
Author

desgith commented Feb 27, 2023

Hi,
I dont see any errors, i am seeing no restarts in the containers as well

NAME                            READY   STATUS             RESTARTS          AGE
mongodb-0                       1/1     Running            0                 45h
mongodb-1                       1/1     Running            0                 45h
mongodb-arbiter-0               1/1     Running            0                 45h

The log is very big, with errors related to missing username as well, which i tried creating using custom usernames let me know if you need it

@desgith
Copy link
Author

desgith commented Feb 28, 2023

Any update on this request?

@aoterolorenzo
Copy link
Contributor

Hi @desgith,

Anything showing up in the container logs?

kubectl logs mongodb-0

Also, seems you are installing a cluster, could you provide the exact values for replicating your same example?

@ghost
Copy link

ghost commented Mar 10, 2023

@aoterolorenzo I've got a a similar issue:

rs0 [primary] admin> show dbs
admin   172.00 KiB
config  216.00 KiB
local   444.00 KiB

$ helm upgrade --install rc-mongo mongodb/mongodb -f mongodb-dev-values.yaml -n rc

mongodb-dev-values.yaml

auth:
  usernames:
    - rocketchat
  databases:
    - rocketchat
  passwords:
    - rocketchat
  rootPassword: rocketchat
architecture: replicaset
useStatefuleSet: false
replicaCount: 3
affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: "node-role.kubernetes.io/control-plane"
          operator: DoesNotExist
        - key: "node-role.kubernetes.io/etcd"
          operator: DoesNotExist
        - key: "node-role.kubernetes.io/master"
          operator: DoesNotExist
arbiter:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: "node-role.kubernetes.io/control-plane"
            operator: DoesNotExist
          - key: "node-role.kubernetes.io/etcd"
            operator: DoesNotExist
          - key: "node-role.kubernetes.io/master"
            operator: DoesNotExist

@ghost
Copy link

ghost commented Mar 10, 2023

mongo-db-0.txt

@aoterolorenzo
Copy link
Contributor

Hi @benhosmereop,

The configuration values seems OK so probably there is a bug behind the issue. I will raise an internal task for our team to investigate this. We will be in touch over this conversation when it gets to an outcome. Meanwhile, I will mark it as on hold to prevent the bitnami-bot from closing it.

@aoterolorenzo aoterolorenzo added on-hold Issues or Pull Requests with this label will never be considered stale and removed in-progress labels Mar 22, 2023
@fhbmax
Copy link

fhbmax commented Mar 30, 2023

I hit the same issue using the helm chart with the extra values for auth.databases, auth.usernames and auth.passwords.
The created users weren't able to connect to the databases (which didn't show up when checking as root).
We had to manually add the roles dbAdmin additionally to the readWrite role to the extra users using the mongosh:

db.createUser({
    user: 'testuser',   
    pwd: '<password>',  
    roles: [  
        {role: 'readWrite', db: 'testdb'},   
        {role: 'dbAdmin', db: 'testdb'}`
    ]  
});  

Then it would work as expected.

@sagimann
Copy link

Did you try to check if the db exists even though it's not showing up on show dbs? See this article. I had the same symptom, but the dbs and their users were actually there. I was able to login, assuming the auth db is where the user was created:

kubectl run --namespace default mongo-mongodb-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mongodb:5.0.18-debian-11-r10 --command -- mongosh admin --host "mongo-mongodb" --authenticationDatabase testdb -u myuser -p 12345
use testdb
testdb> db.collection1.insertOne({name:"hello"})
testdb> show collections
collection1

@github-actions github-actions bot removed the on-hold Issues or Pull Requests with this label will never be considered stale label Jun 20, 2023
@github-actions github-actions bot added the triage Triage is needed label Jun 20, 2023
@rafariossaa
Copy link
Contributor

Hi,
@fhbmax , @desgith , @benhosmereop Did you have the chance to check what @sagimann indicated ?

@github-actions
Copy link

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Jul 13, 2023
@github-actions
Copy link

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2023
@virtyaluk
Copy link

Although this issue has been closed for more than a year now, I just happened to run into the same problem it turned out that the database has been created and I can actually use it, but it still doesn't show up in the list of available databases. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mongodb solved stale 15 days without activity tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

8 participants