helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update && helm repo list
Config
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
Install
helm show values bitnami/redis --version=19.6.4|less
helm show values bitnami/redis --version=20.0.2|less
|
kubectl get ns|grep redis
kubectl delete ns redis
|
kubectl get ns|grep redis
kubectl create ns redis
|
|
cat <<YML | helm -n redis install redis bitnami/redis --version=20.0.2 -f -
---
global:
storageClass: standard
redis:
password: sadaqah!
master:
count: 1
service:
nodePorts:
redis: 30000
replica:
replicaCount: 1
YML
|
|
redis-cli -h redis.k8s.local
|
redis-cli -h replica.redis.k8s.local
|
|
Uninstall
helm uninstall -n redis redis
kubectl delete namespace redis
Swiss Knife
kubectl -n redis run -i --tty --rm redis-cli --image=alpine --restart=Never -- sh
echo -n Password:;read -s REDISCLI_AUTH;export REDISCLI_AUTH
apk --update add redis inetutils-telnet
echo 'ping'|redis-cli -h redis-replicas.redis.svc.cluster.local
echo 'ping'|redis-cli -h redis-replicas.redis.svc
echo 'ping'|redis-cli -h redis-replicas.redis
echo 'ping'|redis-cli -h redis-replicas
echo 'ping'|redis-cli -h redis-master.redis.svc.cluster.local
echo 'ping'|redis-cli -h redis-master.redis.svc
echo 'ping'|redis-cli -h redis-master.redis
echo 'ping'|redis-cli -h redis-master
echo 'ping'|redis-cli -h redis-master
Playground
helm -n redis install redis bitnami/redis --version=19.6.4
helm -n redis upgrade -i redis bitnami/redis --version=20.0.2
helm show values bitnami/redis --version=20.0.2|less
|
|
kubectl -n redis get secret redis -o json|jq -r '.data."redis-password"'|base64 -d;echo
kubectl -n redis exec -it svc/redis-replicas -c redis -- bash
kubectl -n redis exec -it svc/redis-master -c redis -- bash
|
|
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
|
|
kubectl -n redis delete all --all
kubectl -n redis delete ing --all
kubectl -n redis delete sts --all
|
kubectl -n redis delete svc --all
kubectl -n redis delete pvc --all
kubectl -n redis delete pv --all
|
|
kubectl -n redis rollout history sts redis
kubectl -n redis rollout restart sts redis
kubectl -n redis rollout status sts redis
|
kubectl -n redis exec -it svc/redis-master -- redis-cli
kubectl -n redis logs -f svc/redis-master -c redis
kubectl -n redis logs -f svc/redis-replicas -c redis
|
References