Charts: mongodbDatabase not created and mongodbUsername cannot login

Created on 4 Sep 2019  路  10Comments  路  Source: helm/charts

Describe the bug
A clear and concise description of what the bug is.

Version of Helm and Kubernetes:
1.13

Which chart:
stable/mongodb

What happened:
User mongodbUsername created (visible in system.users) but impossible to log in with mongo <db> -u <user> -p <pw> --authenticationDatabase admin. Loging in as root works
Database mongodbDatabaseis not created.
However init logs show that it is created, but doing show dbs as root doesn't list it. Doing use db...will create the database

What you expected to happen:
The database should be created and the user should be able to log in

How to reproduce it (as minimally and precisely as possible):
I am using terraform. I checked that all variables are defined

resource "helm_release" "mongo-db" {
    name      = "mongodb"
    namespace = "botfront"
    chart     = "stable/mongodb"
    set {
        name  = "mongodbUsername"
        value = "${var.mongo_username}"
    }
    set {
        name  = "mongodbPassword"
        value = "${var.mongo_password}"
    }
    set {
        name  = "mongodbRootPassword"
        value = "rootPw"
    }
    set {
        name  = "mongodbDatabase"
        value = "${var.mongo_database_name}"
    }
}

Anything else we need to know:

lifecyclstale

Most helpful comment

Hi @znat ,
Please, could you edit the title of the issue to reference the problem?
Apart from that, I have checked it and it seems you're right, the database is not created, I am going to create an internal task to fix this.
Thank you very much for reporting.

All 10 comments

Hi @znat ,
Please, could you edit the title of the issue to reference the problem?
Apart from that, I have checked it and it seems you're right, the database is not created, I am going to create an internal task to fix this.
Thank you very much for reporting.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

Hello guys,

I'm experiencing exactly the same thing. Any clue on what's going on here? This is blocking our deployment :(

For me, mysteriously, it works now on new deployments.

@znat @miguelaeh I'm still perfectly able to reproduce the issue, simply running the exemplar command in the readme:

helm install --name my-release \
  --set mongodbRootPassword=secretpassword,mongodbUsername=my-user,mongodbPassword=my-password,mongodbDatabase=my-database \
    stable/mongodb

If I enter the container and I do mongo -u my-user --authenticationDatabase admin and I enter the password I get

2019-10-18T12:44:43.565+0000 E QUERY    [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed

If I enter as root user I can successfully authenticate, but if I try to list the dbs with show dbs I get

admin   0.000GB
config  0.000GB
local   0.000GB

@znat are you installing the latest version of the chart or are you sticking to a specific one?

This is not at all a secondary issue... it's vital to bring the mongodb container to life :(

Any help is greatly appreciated!

Thanks,

-Luca

Aaaaaa discovered the issue!

By default the auth database is not admin, but the same database it's been created (in the example above my-database).

Sorry for bothering you guys...I guess it's all solved at this point. As a note, I this is not that immediate to understand. I would add a note in the documentation for this.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

This issue is being automatically closed due to inactivity.

The issue seems to be back. Now I'm not using terraform anymore, but using this chart as a dependency in another chart. Here are my values:

mongodb:
  mongodbUsername: rw
  mongodbPassword: password
  mongodbRootUsername: root
  mongodbRootPassword: password
  mongodbDatabase: bf

mongo bf -u rw -p password --authenticationDatabase admin fails

However, I can login as root and do:

> use bf
switched to db bf
> db.getUsers()
[
    {
        "_id" : "bf.rw",
        "userId" : UUID("95981ad3-05fe-44e2-b1da-cd6a84ce76da"),
        "user" : "rw",
        "db" : "bf",
        "roles" : [
            {
                "role" : "readWrite",
                "db" : "bf"
            }
        ],
        "mechanisms" : [
            "SCRAM-SHA-1",
            "SCRAM-SHA-256"
        ]
    }
]

Any idea?

@LucaPrete how did you solve that in the end? I read your comment about the database created being the authenticating one, but doing mongo bf -u rw -p password --authenticationDatabase bf didn't help

Ok, got it. Just needed to not specify an authentication database

Was this page helpful?
0 / 5 - 0 ratings