<p>I installed mongodb on kubernetes using helm:</p>
<pre><code>helm install mongo bitnami/mongodb
</code></pre>
<p>now i'm trying to connect using the root password I got using this command</p>
<pre><code># kubectl get secret --namespace default mongo-mongodb -o jsonpath=&quot;{.data.mongodb-root-pa
ssword}&quot; | base64 --decode
AXMCSkdNm6
</code></pre>
<p>using the root password, with the user root, i can't login. I get Authentication Failed error. trying in my mongodb desktop client, also tried inside of mongo pod:</p>
<pre><code>$ mongo admin --username root --password AXMCSkdNm6
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&amp;gssapiServiceName=mongodb
Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
</code></pre>
<p>What am I doing wrong?</p>
<p><strong>Update</strong>:</p>
<p>I managed to reproduce it always on clean install of k8s/helm:</p>
<ol>
<li>install mongo the first time - authentication works perfectly</li>
<li>delete mongo via <code>helm delete mongo</code></li>
<li>install mongo now - authentication fails</li>
</ol>

<p>OK, I found out the issue after a very long time...</p>
<p>MongoDB authentication stopped working after I deleted the release and created a new release. The reason was that I used the same persistent storage for both releases. So, when I deleted the first release the data was not deleted, and when I started a new release, it got confused, since it used the old data from the previous release...</p>
<p>When I delete all the data in the persistent storage when deleting the release - everything worked correctly.</p>
