Unable to install Mongodb 5.0.8 on K8s mkdir: cannot create directory '/bitnami/mongodb': Permission denied

HI all

Need some help ! I am trying to install Mongodb on aws nodes (its a 4 node cluster Rhel 8.5 OS) Using K8s 1.23 Installing Mongodb is faling.
helm repo add bitnami from charts bitnami
helm install my-release bitnami/mongodb-sharded --namespace=mongodb --set global.storageClass=vxflexos-xfs --set mongodbRootPassword=mongodb123,mongodbUsername=mongodb,mongodbPassword=mongodb123,mongodbDatabase=ycsb --set volumePermissions.enabled=true --set replicaSet.enabled=true --set shards=2 --set configsvr.replicas=1 --set configsvr.persistence.size=100Gi --set mongos.replicas=1 --set shardsvr.dataNode.replicas=1 --set shardsvr.persistence.size=500Gi --set shardsvr.dataNode.resources.requests.memory=64Gi --set shardsvr.dataNode.resources.requests.cpu=16 --set configsvr.resources.requests.memory=16Gi --set mongos.resources.requests.memory=16Gi

Using this command however Kubectl logs says the following :

[root@Mongo-K8Master ec2-user]# kubectl logs -n mongodb my-release-mongodb-sharded-shard1-data-0
13:22:29.35 INFO ==> Setting node as primary
mongodb 13:22:29.38
mongodb 13:22:29.38 Welcome to the Bitnami mongodb-sharded container
mongodb 13:22:29.38 Subscribe to project updates by watching GitHub - bitnami/bitnami-docker-mongodb-sharded: Bitnami Docker Image for MongoDB Sharded
mongodb 13:22:29.38 Submit issues and feature requests at Issues · bitnami/bitnami-docker-mongodb-sharded · GitHub
mongodb 13:22:29.38
mongodb 13:22:29.38 INFO ==> ** Starting MongoDB Sharded setup **
mongodb 13:22:29.42 INFO ==> Validating settings in MONGODB_* env vars…
mkdir: cannot create directory ‘/bitnami/mongodb’: Permission denied

  1. If i try to use chown permissions to /bitmani/mongodb-- it says directory doesn’t exist
  2. I tried using --set volumePermissions.enabled=true option but no luck
    I also tried without --set volumePermissions.enabled=true option in this case I am able to make the pods run fine but after i exec to pods I am not able to login to database it gives authentication error

[root@Mongo-K8Master mongobackup]# kubectl exec my-release-mongodb-sharded-shard0-data-0 -n mongodb -it – bash
Defaulted container “mongodb” out of: mongodb, volume-permissions (init)
I have no name!@my-release-mongodb-sharded-shard0-data-0:/$
I have no name!@my-release-mongodb-sharded-shard0-data-0:/$ mongo admin --username root -p mongodb123 --host 10.244.3.36 --port 27017
MongoDB shell version v5.0.8
connecting to: mongodb://10.244.3.36:27017/admin?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 10.244.3.36:27017, connection attempt failed: SocketException: Error connecting to 10.244.3.36:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
I have no name!@my-release-mongodb-sharded-shard0-data-0:/$

Please help me overcome this

/bitmani vs /bitnami
Is that a typo? or that’s what you used while chown?

Its a type my bad ! but i used the right command and it was out of the container like from the K8s root prompt to be precise

@Jason_Tran Could you help me here ? or tag someone who could I am stuck with this error badly !

Also chrisChris DellawayMongoDB Champion may be able to help you
He resolved many installation related issues

@chris Can you please share some inputs on the issue i am facing stuck with this from a few days now

@Ramachandra_Tummala I am looking for creating a dbuser who can have full access to a database named “ycsb”
to do so i am using
use ycsb
db.getSiblingDB(‘admin’).createUser({ user: ‘mongodb’, pwd: ‘mongodb123’, roles: [{role: ‘userAdminAnyDatabase’, db: ‘ycsb’}] });

Can you please help me do so something is wrong in above command
uncaught exception: Error: couldn’t add user: No role named userAdminAnyDatabase@ycsb :

All i need is all possible role permission for a user who is non-root and access to that databse fully.

The role userAdminAnyDatabase is in contraction with db:ycsb. Because userAdminAnyDatabase is for userAdmin on any database. While db:ycsb restrict to a single database.

It look like what you want is https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-userAdmin.

Thanks @steevej This is helpful but i am new to this so still cant figure out for my use case
What exact command should i use of creating a dbuser (say “john”) who has full access to a database name (say “HRteam” or “test” )

so that when i run the test using that dbuser on that database i do not face any issues…

I usually see a click count that indicates how often a link I shared is followed by a peer user. I do not see one in my previous post. So I will have to assume you did not go read the documentation I supplied.

Like I wrote userAdminAnyDatabase is wrong. What you need is userAdmin.

And since you are

I recommend M103 and M150 from Online Courses | MongoDB University

@steevej I will somehow figure out, I am not sure why you dont see the click count however I did check the link, and even before posting it here I had read those options roles and permissions but for my use case I was facing issues.

Anyway Thanks for the revert!

1 Like

Does it work now with userAdmin rather than userAdminAnyDatabase?