<p>I have described helm template for redis&quot;</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: &quot;{{ .Values.rds.service.name }}&quot;
  namespace: {{ .Values.environment.namespace }}
spec:
  selector:
    matchLabels:
      app: &quot;{{ .Values.rds.service.name }}&quot;
  template:
    metadata:
      labels:
        app: &quot;{{ .Values.rds.service.name }}&quot;
        component_type: &quot;{{ .Values.component_type.name }}&quot;
    spec:
      containers:
        - image: &quot;{{ .Values.rds.docker.hub }}{{ .Values.rds.docker.image }}&quot;
          name: &quot;{{ .Values.rds.service.name }}&quot;
          env:
            - name: REDIS_PASSWORD
              value: &quot;9dtjger&quot;
          ports:
            - containerPort: {{ toYaml .Values.rds.service.port | indent 5 }}
          resources:
            requests:
              memory: &quot;{{ .Values.rds.resources.requests.memory }}&quot;
              cpu: &quot;{{ .Values.rds.resources.requests.cpu }}&quot;
            limits:
              memory: &quot;{{ .Values.rds.resources.limits.memory }}&quot;
              cpu: &quot;{{ .Values.rds.resources.limits.cpu }}&quot;

---
apiVersion: v1
kind: Service
metadata:
  name: &quot;{{ .Values.rds.service.name }}&quot;
  namespace: &quot;{{ .Values.environment.namespace }}&quot;
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: &quot;3600&quot;
    service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: &quot;true&quot;
    service.beta.kubernetes.io/aws-load-balancer-internal: &quot;true&quot;
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
    service.beta.kubernetes.io/aws-load-balancer-type: &quot;nlb&quot;
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: Department=sre,Team=engage-devops,Environment=ev-lab
    external-dns.alpha.kubernetes.io/hostname: {{ .Values.rds.service.name }}.{{ .Values.environment.namespace }}.lab.engage.ringcentral.com
spec:
  ports:
    - protocol: TCP
      port: {{ toYaml .Values.rds.service.port | indent 5 }}
  selector:
    app: &quot;{{ .Values.rds.service.name }}&quot;
  type: LoadBalancer
</code></pre>
<p>Then I deployed it via kubectl apply:</p>
<pre class="lang-yaml prettyprint-override"><code>kubectl -n mybanespace describe pod rds-5b6996bf-m6pbr 
Name:           rds-5b6996bf-m6pbr
Namespace:      okta-cc-6
Priority:       0
Node:           ip-10-8-29-49.eu-central-1.compute.internal/10.8.29.49
Start Time:     Mon, 03 Aug 2020 21:55:09 +0300
Labels:         app=rds
                component_type=evt
                pod-template-hash=5b6996bf
Annotations:    kubernetes.io/psp: eks.privileged
Status:         Running
IP:             10.8.29.39
IPs:            &lt;none&gt;
Controlled By:  ReplicaSet/rds-5b6996bf
Containers:
  rds:
    Container ID:   docker://3be73237324f8ba8c0a38420fceffcee65eb386e93afd8efa309212527761c74
    Image:          redis:6.0.6
    Image ID:       docker-pullable://redis@sha256:d86d6739fab2eaf590cfa51eccf1e9779677bd2502894579bcf3f80cb37b18d4
    Port:           6379/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 03 Aug 2020 21:55:14 +0300
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     40m
      memory:  100Mi
    Requests:
      cpu:     2m
      memory:  10Mi
    Environment:
      REDIS_PASSWORD:  9dtjger
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-78c7b (ro)
</code></pre>
<p>When I try to connect to redis with the password I get error <code>'Warning: AUTH failed'</code> if I connect without password - <code>connection successful</code>. I don't know why the password doesn't work when I use :</p>
<pre class="lang-yaml prettyprint-override"><code>env:
   - name: REDIS_PASSWORD
     value: &quot;9dtjger&quot;
</code></pre>
<p>In docker-compose locally I cannot connect without a password.</p>
<p>How can I set a password for Redis in Kubernetes?</p>

<p>You didn't specify how you installed Redis❓ (Which Helm Chart). Essentially adding the <code>--requirepass ${REDIS_PASSWORD}&quot;</code> and <code>--masterauth ${REDIS_PASSWORD}&quot;</code> should do 👌.</p>
<p>If for example, you used the Bitnami Helm chart, you can use the <a href="https://github.com/bitnami/charts/tree/master/bitnami/redis#parameters" rel="nofollow noreferrer"><code>usePassword</code></a> parameter. Then in the template, it gets used <a href="https://github.com/bitnami/charts/blob/master/bitnami/redis/templates/redis-master-statefulset.yaml#L106" rel="nofollow noreferrer">here</a>.</p>
<p>✌️</p>
