Bitnami Redis on Kubernetes Authentication Failure with Existing Secret
You can achieve it in much simpler way i.e. by running:
$ helm install my-release \ --set auth.password="admin1234" \ bitnami/redis
This will update your "my-release-redis"
secret, so when you run:
$ kubectl get secrets my-release-redis -o yaml
you'll see it contains your password, already base64
-encoded:
apiVersion: v1data: redis-password: YWRtaW4xMjM0Cg==kind: Secret...
In order to get your password, you need to run:
export REDIS_PASSWORD=$(kubectl get secret --namespace default my-release-redis -o jsonpath="{.data.redis-password}" | base64 --decode)
This will set and export REDIS_PASSWORD
environment variable containing your redis password.
And then you may run your redis-client
pod:
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
which will set REDIS_PASSWORD
environment variable within your redis-client
pod by assigning to it the value of REDIS_PASSWORD
set locally in the previous step.
The issue was about how i encoded password with echo command. There was a newline character at the end of my password. I tried with printf command rather than echo and it created a different result.
printf admin1234 | base64