install redis on kubernetes
## set repo
[root@k8smaster ~]# helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories
## set repo
[root@k8smaster ~]# helm repo add bitnami https://charts.bitnami.com/bitnami^C
[root@k8smaster ~]# helm install bitnami/redis
NAME: esteemed-pug
LAST DEPLOYED: Wed Jun 24 18:16:53 2020
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
esteemed-pug-redis 3 0s
esteemed-pug-redis-health 6 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
esteemed-pug-redis-master-0 0/1 Pending 0 0s
esteemed-pug-redis-slave-0 0/1 Pending 0 0s
==> v1/Secret
NAME TYPE DATA AGE
esteemed-pug-redis Opaque 1 0s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
esteemed-pug-redis-headless ClusterIP None <none> 6379/TCP 0s
esteemed-pug-redis-master ClusterIP 10.104.147.249 <none> 6379/TCP 0s
esteemed-pug-redis-slave ClusterIP 10.97.255.19 <none> 6379/TCP 0s
==> v1/StatefulSet
NAME READY AGE
esteemed-pug-redis-master 0/1 0s
esteemed-pug-redis-slave 0/2 0s
NOTES:
** Please be patient while the chart is being deployed **
Redis can be accessed via port 6379 on the following DNS names from within your cluster:
esteemed-pug-redis-master.default.svc.cluster.local for read/write operations
esteemed-pug-redis-slave.default.svc.cluster.local for read-only operations
To get your password run:
export REDIS_PASSWORD=$(kubectl get secret --namespace default esteemed-pug-redis -o jsonpath="{.data.redis-password}" | base64 --decode)
To connect to your Redis server:
1. Run a Redis pod that you can use as a client:
kubectl run --namespace default esteemed-pug-redis-client --rm --tty -i --restart='Never' \
--env REDIS_PASSWORD=$REDIS_PASSWORD \
--image docker.io/bitnami/redis:6.0.5-debian-10-r10 -- bash
2. Connect using the Redis CLI:
redis-cli -h esteemed-pug-redis-master -a $REDIS_PASSWORD
redis-cli -h esteemed-pug-redis-slave -a $REDIS_PASSWORD
To connect to your database from outside the cluster execute the following commands:
kubectl port-forward --namespace default svc/esteemed-pug-redis-master 6379:6379 &
redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD
[root@k8smaster ~]#
댓글
댓글 쓰기