MongoDB Helm chart: database and user are not created
Which chart: https://github.com/bitnami/charts/tree/master/bitnami/mongodb
Describe the bug
According to documentation, I need to set the following values to create a table and a user:
auth.username, auth.password, and auth.database.
But, when I set the above values, the table and user are not created.
To Reproduce
- Run the sample command from the README:
helm install my-release \
--set auth.rootPassword=secretpassword,auth.username=my-user,auth.password=my-password,auth.database=my-database \
bitnami/mongodb
- Wait for the pod to be in Ready state and exec into the container:
kubectl exec -i -t -n default my-release-mongodb-8464567cf8-m9ldk -c mongodb -- sh
- Run mongo shell and list all DBs and users
mongo admin -u root -p $MONGODB_ROOT_PASSWORD
show dbs
show users
Please note that the output for the show commands does not list the my-database database nor the my-user user.
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
> show users
{
"_id" : "admin.root",
"userId" : UUID("d77db4f4-a881-4623-8bd6-843860138015"),
"user" : "root",
"db" : "admin",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
],
"mechanisms" : [
"SCRAM-SHA-1",
"SCRAM-SHA-256"
]
}
Please also note that the following environmental variables are created inside the mongodb container with the correct values:
MONGODB_DATABASE=my-database
MONGODB_USERNAME=my-user
MONGODB_PASSWORD=my-password
Expected behaviour
A database called my-database is created.
A user called my-user is created.
Version of Helm and Kubernetes:
- Output of
helm version:
version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"clean", GoVersion:"go1.14.13"}
- Output of
kubectl version:
Client Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.9-eks-d1db3c", GitCommit:"d1db3c46e55f95d6a7d3e5578689371318f95ff9", GitTreeState:"clean", BuildDate:"2020-10-20T22:21:03Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.20-eks-8c579e", GitCommit:"8c579edfc914f013ff48b2a2b2c1308fdcacc53f", GitTreeState:"clean", BuildDate:"2021-07-31T01:34:13Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Hi @tsboris , Does it work if you try to login with the specified user and password?
Apparently, it was working all the time... The issue was my lack of understanding of MongoDB internals and shell commands... :-(