<p>I'm trying to install Redis on Kubernetes environment with <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis" rel="nofollow noreferrer">Bitnami Redis HELM Chart</a>. I want to use a defined password rather than randomly generated one. But i'm getting error below when i want to connect to redis master or replicas with redis-cli.</p>
<pre><code>I have no name!@redis-client:/$ redis-cli -h redis-master -a $REDIS_PASSWORD 
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Warning: AUTH failed
</code></pre>
<p>I created a Kubernetes secret like this.</p>
<pre><code>---
apiVersion: v1
kind: Secret
metadata:
  name: redis-secret
  namespace: redis
type: Opaque
data:
  redis-password: YWRtaW4xMjM0Cg==
</code></pre>
<p>And in values.yaml file i updated auth spec like below.</p>
<pre><code>auth:
  enabled: true
  sentinel: false
  existingSecret: &quot;redis-secret&quot;
  existingSecretPasswordKey: &quot;redis-password&quot;
  usePasswordFiles: false
</code></pre>
<p>If i don't define <code>existingSecret</code> field and use randomly generated password then i can connect without an issue. I also tried <code>AUTH admin1234</code> after <code>Warning: AUTH failed</code> error but it didn't work either.</p>

Çağatay Çiftçi
<p>You can achieve it in much simpler way i.e. by running:</p>
<pre><code>$ helm install my-release \
  --set auth.password=&quot;admin1234&quot; \
    bitnami/redis
</code></pre>
<p>This will update your <code>&quot;my-release-redis&quot;</code> secret, so when you run:</p>
<pre><code>$ kubectl get secrets my-release-redis -o yaml
</code></pre>
<p>you'll see it contains your password, already <code>base64</code>-encoded:</p>
<pre><code>apiVersion: v1
data:
  redis-password: YWRtaW4xMjM0Cg==
kind: Secret
...
</code></pre>
<p>In order to get your password, you need to run:</p>
<pre><code>export REDIS_PASSWORD=$(kubectl get secret --namespace default my-release-redis -o jsonpath=&quot;{.data.redis-password}&quot; | base64 --decode)
</code></pre>
<p>This will set and export <code>REDIS_PASSWORD</code> environment variable containing your redis password.</p>
<p>And then you may run your <code>redis-client</code> pod:</p>
<pre><code>kubectl run --namespace default redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io/bitnami/redis:6.2.4-debian-10-r13 --command -- sleep infinity
</code></pre>
<p>which will set <code>REDIS_PASSWORD</code> environment variable within your <code>redis-client</code> pod by assigning to it the value of <code>REDIS_PASSWORD</code> set locally in the previous step.</p>
