<p>So trying to create database in a replicaset using helm, using the following values in values.yaml</p>
<pre><code>mongodb:
  architecture: replicaset
  auth:
    rootPassword: &quot;admin&quot;
    usernames: 
      - &quot;user1&quot;
    passwords: 
      - &quot;password1&quot;
    databases: 
      - &quot;mydatabase&quot;
    replicaSetKey: myreplicaKey
</code></pre>
<p>Installing the chart using the following command:</p>
<pre><code>helm install sam bitnami/mongodb --set architecture=&quot;replicaset&quot;,auth.rootPassword=password123 --values values.yaml
</code></pre>
<p>Log into my database:</p>
<pre><code>export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace default sam-mongodb -o jsonpath=&quot;{.data.mongodb-root-password}&quot; | base64 --decode)
kubectl exec -ti sam-mongodb-0 -- mongo --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD
</code></pre>
<p>But cannot see my database called &quot;mydatabase&quot; or specific user &quot;user1&quot; created, I can authenticate with admin user but trying to authenticate to &quot;mydatabase&quot; says failed, so unsure why this is happening, as it works in standalone but not a replicaset.</p>
<pre><code>rs0:PRIMARY&gt; show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
rs0:PRIMARY&gt; use admin
switched to db admin
rs0:PRIMARY&gt; show users
{
    &quot;_id&quot; : &quot;admin.root&quot;,
    &quot;userId&quot; : UUID(&quot;2b74bb99-5e18-434f-8350-9d54eb562230&quot;),
    &quot;user&quot; : &quot;root&quot;,
    &quot;db&quot; : &quot;admin&quot;,
    &quot;roles&quot; : [
        {
            &quot;role&quot; : &quot;root&quot;,
            &quot;db&quot; : &quot;admin&quot;
        }
    ],
    &quot;mechanisms&quot; : [
        &quot;SCRAM-SHA-1&quot;,
        &quot;SCRAM-SHA-256&quot;
    ]
}

</code></pre>
<p>Was wondering if anyone knew what I might be doing wrong. Thanks</p>

sam
<p>deleted the pvc and re-authenticated, and worked.</p>
<pre><code>rs0:PRIMARY&gt; use mydatabase
switched to db mydatabase
rs0:PRIMARY&gt; db.auth('user1','password1')
1
</code></pre>
