Shutdown all dependencies before proceed
export REDIS_PREFIX=backend
export REDIS_NAME=${REDIS_PREFIX}-redis
oc scale --replicas=0 dc ${REDIS_NAME}
oc delete dc,svc ${REDIS_NAME}
As PV use the existing storage
oc process -f templates/redis-master.yml \
-p REDIS_SERVICE_PREFIX=${REDIS_PREFIX} \
-p REDIS_IMAGE=redis-ha:latest \
-p REDIS_PV=${REDIS_PREFIX}-storage \
| oc create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: backend-redis-rwx-storage
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
oc create -f /tmp/storage.yml
Using the new storage create the slave redis. Wait the master pod to start up before proceed
oc process -f templates/redis-slave.yml \
-p REDIS_SERVICE_PREFIX=${REDIS_PREFIX} \
-p REDIS_IMAGE=redis-ha:latest \
-p REDIS_PV=${REDIS_NAME}-rwx-storage \
| oc create -f -
oc process -f templates/redis-sentinel.yml \
-p REDIS_SERVICE_PREFIX=${REDIS_PREFIX} \
-p REDIS_IMAGE=redis-ha:latest \
| oc create -f -
oc scale --replicas=0 dc ${REDIS_NAME}-master
Override the master data storage with the new RWX storage
oc volume dc/${REDIS_NAME}-master --add --name=data --type=pvc --claim-name=${REDIS_NAME}-rwx-storage -m /var/lib/redis/data --overwrite
oc delete pvc ${REDIS_NAME}-storage
TBD