Redis 6.2.7 | with Helm Chart
Deploying a stateless Go app with Redis on Kubernetes | CalliCoder
https://rancher.com/blog/2019/deploying-redis-cluster/
charts/bitnami/redis at master · bitnami/charts
# helm repo add bitnami https://charts.bitnami.com/bitnami
# helm repo update
# helm pull bitnami/redis # redis-16.13.2.tgz, Redis 6.2.7
# helm show values ./redis-16.13.2.tgz > redis-16.13.2.helm-values.yaml
...(1)修改存储类:global.storageClass
...(2)修改运行模式:默认 replication 模式,我们使用 standalone 模式(测试目的);
# helm --namespace infra-database \
install redis bitnami/redis -f redis-16.13.2.helm-values.yaml \
--create-namespace
# helm --namespace infra-database \
upgrade redis bitnami/redis -f redis-16.13.2.helm-values.yaml
// ---------------------------------------------------------------------------- // 当执行成功后,产生如下输出:
...
Redis® can be accessed via port 6379 on the following DNS name from within your cluster:
redis-master.infra-database.svc.cluster.local
To get your password run:
export REDIS_PASSWORD=$(kubectl get secret --namespace infra-database redis -o jsonpath="{.data.redis-password}" | base64 -d)
To connect to your Redis® server:
1. Run a Redis® pod that you can use as a client:
kubectl run --namespace infra-database redis-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image docker.io/bitnami/redis:6.2.7-debian-11-r11 --command -- sleep infinity
Use the following command to attach to the pod:
kubectl exec --tty -i redis-client \
--namespace infra-database -- bash
2. Connect using the Redis® CLI:
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
To connect to your database from outside the cluster execute the following commands:
kubectl port-forward --namespace infra-database svc/redis-master 6379:6379 &
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379