MongoDB-CR Authentication failed

go to mongoDB console and delete your current user & set authSchema version to 3 instead of 5 , follow these commands in mongo console –

mongo
use admin
db.system.users.remove({})    <== removing all users
db.system.version.remove({}) <== removing current version 
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })

Now restart the mongod and create new user then it should work fine.

Note: use remove commands in test db only, if in production use update.

Authentication information for Kubernetes Helm Chart

If you delete the all users and authentication is enabled in the configuration (or --auth param which is set per default on the Kubernetes helm chart), it’s not possible to access MongoDB any more. Its required to disable authentication, create a new user and then re-enable it.

On Kubernetes you need to edit the parameters and add --noauth as argument, since it’s not the default there as on a classic installed MongoDB. Please see the CLI documentation for more information about --noauth and the corresponding --auth.

Leave a Comment