4

I installed mongodb using Helm in my Kubernetes cluster. https://github.com/kubernetes/charts/tree/master/stable/mongodb

It works fine and lets me connect to the db. But I cannot do any operation once I log into the mongo server. Here is the error I get when I try to see the collections.

    > show collections;
2018-04-19T18:03:59.818+0000 E QUERY    [js] Error: listCollections failed: {
    "ok" : 0,
    "errmsg" : "not authorized on test to execute command { listCollections: 1.0, filter: {}, $db: \"test\" }",
    "code" : 13,
    "codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:942:1
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:954:19
DB.prototype.getCollectionNames@src/mongo/shell/db.js:965:16
shellHelper.show@src/mongo/shell/utils.js:836:9
shellHelper@src/mongo/shell/utils.js:733:15
@(shellhelp2):1:1

I am logging in as the root user using

mongo -p password

I don't know why even the root user has no authorization to do anything.

2
  • which parameters are you using to install the helm chart? Commented Apr 25, 2018 at 8:33
  • Same here... I didnt have this issue last time I did this. Not sure whats going on so far. Commented Sep 7, 2018 at 15:19

1 Answer 1

1

I found the issue. By default, MongoDB uses the admin DB to authenticate but in the helm chart, the authentication DB is the same as the DB that you create with it. So If I create a DB called test, the authentication DB will also be test

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.