<p>mongodb on kubernetes user and password Authentication failed</p>
<pre><code>kubectl create -f https://raw.githubusercontent.com/piomin/sample-spring-boot-on-kubernetes/master/k8s/mongodb-deployment.yaml  
</code></pre>
<p>waitting...</p>
<pre class="lang-sh prettyprint-override"><code>➜  kubernetes git:(master) ✗ kubectl get pods -o wide
NAME                       READY   STATUS    RESTARTS   AGE   IP           NODE       NOMINATED NODE   READINESS GATES
mongodb-7d49f8dbb7-6lj9h   1/1     Running   0          27s   172.17.0.3   minikube   &lt;none&gt;           &lt;none&gt;
kubectl exec -it mongodb-7d49f8dbb7-6lj9h bash                                                                                  
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@mongodb-7d49f8dbb7-6lj9h:/# mongosh
Current Mongosh Log ID: 61df98f4e11d99416ba76c7c
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&amp;serverSelectionTimeoutMS=2000
Using MongoDB:          5.0.5
Using Mongosh:          1.1.7

test&gt; db.auth('dGVzdA==','UGlvdF8xMjM=')
MongoServerError: Authentication failed.
test&gt; use admin
switched to db admin
admin&gt; db.auth('dGVzdA==','UGlvdF8xMjM=')
MongoServerError: Authentication failed.

</code></pre>
<p>i hope login successful.</p>

ToQuery
<p>You pass BASE64 encoded strings</p>
<pre><code>db.auth('dGVzdA==','UGlvdF8xMjM=')
</code></pre>
<p>must be</p>
<pre><code>db.auth('test','Piot_123')
</code></pre>
<p>(and change your password as soon as possible, because now it is public)</p>
