Kubernetes: redis-master on GKE (Google Kubernetes Engine)

This will create a stateful redis-master with a persistent drive on GKE (no slaves or sentinels).

Clone git repository

https://github.com/itsmetommy/kubernetes-redis-master

Create

kubectl -n itsmetommy apply -f .

Example

kubectl -n itsmetommy apply -f .
service "redis-primary" created
statefulset.apps "redis-primary" created

Connect

kubectl -n itsmetommy exec redis-primary-0 -it redis-cli

Check version

kubectl -n itsmetommy exec redis-primary-0 -it redis-cli info server

Clean up

kubectl -n itsmetommy delete -f .

Example

kubectl -n itsmetommy delete -f .
service "redis-primary" deleted
statefulset.apps "redis-primary" deleted

Delete pvc

kubectl -n itsmetommy delete pvc -l app=redis-primary

Example

kubectl -n itsmetommy delete pvc -l app=redis-primary
persistentvolumeclaim "redis-primary-volume-redis-primary-0" deleted