<p>I am trying to follow the instructions here: <a href="https://github.com/bitnami/charts/tree/master/bitnami/mongodb" rel="nofollow noreferrer">https://github.com/bitnami/charts/tree/master/bitnami/mongodb</a></p>

<p>1) <code>helm install mongorelease --set mongodbRootPassword=secretpassword,mongodbUsername=my-user,mongodbPassword=my-password,mongodbDatabase=my-database bitnami/mongodb</code></p>

<p>which says:</p>

<p>To connect to your database run the following command:</p>

<p>kubectl run --namespace default mongorelease-mongodb-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mongodb:4.2.5-debian-10-r44 --command -- mongo admin --host mongorelease-mongodb --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD</p>

<p>I run the command above (replacing $MONGODB_ROOT_PASSWORD with my password) and I see this error:</p>

<pre><code>error: invalid restart policy: 'Never'
See 'kubectl run -h' for help and examples
</code></pre>

<p>I remove the single quotes around Never and see this:</p>

<pre><code>MongoDB shell version v4.2.5
connecting to: mongodb://mongorelease-mongodb:27017/admin?authSource=admin&amp;compressors=disabled&amp;gssapiServiceName=mongodb
2020-04-11T10:04:52.187+0000 E  QUERY    [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-04-11T10:04:52.189+0000 F  -        [main] exception: connect failed
2020-04-11T10:04:52.189+0000 E  -        [main] exiting with code 1
pod "mongorelease-mongodb-client" deleted
pod default/mongorelease-mongodb-client terminated (Error)
</code></pre>

<p>I then remove --restart=Never from the command and run it again.  It then works expected and I can interact with MongoDB, however I am presented with this warning:</p>

<pre><code>kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
</code></pre>

<p>What is the command I should be using?</p>

w0051977
<p><code>--restart=Never</code> creates a pod. So you instead can run this command with <code>--generator=run-pod/v1</code>  to create a pod. This avoids usage of <code>--restart=Never</code> and also the deprecation warning will not be there.</p>

<pre><code>kubectl run --rm --grace-period=1 --force=true --generator=run-pod/v1 --namespace default mongorelease-mongodb-client --tty -i --image docker.io/bitnami/mongodb:4.2.5-debian-10-r44 --command -- mongo admin --host mongorelease-mongodb --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD
</code></pre>
