Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

mongodb-replicaset doesn't create user #2457

Closed
jengo opened this issue Oct 11, 2017 · 1 comment
Closed

mongodb-replicaset doesn't create user #2457

jengo opened this issue Oct 11, 2017 · 1 comment

Comments

@jengo
Copy link

jengo commented Oct 11, 2017

Bug report:

I am trying to setup authentication with mongodb-replicaset. The admin user never gets created.

Helm and tiller version: 2.6.2
Kubernetes version: 1.7.6 (In GKE)
mongodb-replicaset chart version: 1.4.1

What happened:

I ran the command

helm install --set auth.enabled=true,auth.adminUser=test,auth.adminPassword=test,auth.key=test123 stable/mongodb-replicaset

What you expected to happen:
When I ran db.getUsers() on the cluster it returned no users.

How to reproduce it (as minimally and precisely as possible):

helm install --set auth.enabled=true,auth.adminUser=test,auth.adminPassword=test,auth.key=test123 stable/mongodb-replicaset

Anything else we need to know:
I've also tried this on minikube v0.22.3 and get the same behavior.

@jengo
Copy link
Author

jengo commented Oct 13, 2017

I realized this was my fault. The admin user that is created only has access to the admin database.

Here is some additional information on troubleshooting for anyone searching for a solution.

root@test1-mongodb-replicaset-0:/# mongo --eval 'db.getUsers()'
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.9
[ ]

root@test1-mongodb-replicaset-0:/# mongo -u test -p test --eval 'db.getUsers()'
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.9
2017-10-13T00:10:13.621+0000 E QUERY    [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1461:20
@(auth):6:1
@(auth):1:2
exception: login failed

If you connect with the admin database specified, it works as expected:

root@test1-mongodb-replicaset-0:/# mongo admin -u test -p test --eval 'db.getUsers()'
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017/admin
MongoDB server version: 3.4.9
[
	{
		"_id" : "admin.test",
		"user" : "test",
		"db" : "admin",
		"roles" : [
			{
				"role" : "root",
				"db" : "admin"
			}
		]
	}
]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant