I am trying to add a custom user to mongoDB database. I am not using sharding only using repsets. Can this be done ? Below is a snippet from my values file. So far I have no luck. Thanks for any insight. ( my spacing is ok, I cant get it to paste correctly)
replsets:
rs0:
name: rs0
size: 3
users:
- name: my-user
db: admin
passwordSecretRef:
# name: my-user-password
# key: password
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
Hi,
Could you describe the issue you are facing in more detail? Are you getting some errors in logs/when applying cr.yaml
?
From the provided config part the suspicious part is that passwordSecretRef
values are commented out. On 1.18.0 and before the passwordSecretRef
is mandatory, on 1.19.0+ it can be skipped, in which case operator generates secret and password. The examples are available n documentation at link .
2 Likes
Hi
Thanks for your reply. My issue is the user is not being added. My first attempt was using the passwordSecretRef but noticed that 1.19 the operator will create the password for you. So I commented out the REF just in case my error was in my secert but still no user is created. Im only using the repset, sharding is disabled. Are users allowed to be added to the repset section ?
Hi
I got it working. I was defining the user under the replica set definitions and not at the root level. I was able to get the user added. thanks for you help!
2 Likes
Hi!
Glad to hear that you made it work! Feel free to ask if other questions come up. 