kubectl create namespace redis
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update


cat <<EOF | cat > redisvalues.yaml -
architecture: replication

auth:
  enabled: true
  password: KAYQE1QA7uwUZ8uI 

master:
  persistence:
    enabled: true
    storageClass: csi-rbdfs-sc
    size: 5Gi
  resources:
    requests:
      cpu: 100m
      memory: 256Mi

replica:
  replicaCount: 2
  persistence:
    enabled: true
    storageClass: csi-rbdfs-sc
    size: 5Gi
  resources:
    requests:
      cpu: 100m
      memory: 256Mi

sentinel:
  enabled: true
  replicas: 3
  resources:
    requests:
      cpu: 50m
      memory: 64Mi

metrics:
  enabled: false
EOF

helm install redis bitnami/redis  -n redis   -f redisvalues.yaml

#test
kubectl run redis-client -n redis --rm -it --image=redis:7.2 -- redis-cli  -h redis.redis.svc.cluster.local  -a KAYQE1QA7uwUZ8uI



###########################################################################################################################
Redis(R) can be accessed via port 6379 on the following DNS name from within your cluster:

    redis.redis.svc.cluster.local for read only operations

For read/write operations, first access the Redis(R) Sentinel cluster, which is available in port 26379 using the same domain name above.

To get your password run:

    export REDIS_PASSWORD=$(kubectl get secret --namespace redis redis -o jsonpath="{.data.redis-password}" | base64 -d)

To connect to your Redis(R) server:

1. Run a Redis(R) pod that you can use as a client:

   kubectl run --namespace redis redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image registry-1.docker.io/bitnami/redis:latest --command -- sleep infinity

   Use the following command to attach to the pod:

   kubectl exec --tty -i redis-client \
   --namespace redis -- bash

2. Connect using the Redis(R) CLI:
   REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis -p 6379 # Read only operations
   REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis -p 26379 # Sentinel access

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace redis svc/redis 6379:6379 &
    REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379