- Installing the Redis Operator
# create namespace for operator
oc create ns redis-operator
# register Helm repo
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
# install redis-operator using helm
helm upgrade redis-operator ot-helm/redis-operator \
--install --namespace redis-operator
# validate operator is running
oc get pods -n redis-operator
NAME READY STATUS RESTARTS AGE
redis-operator-78c6c95b78-4w5qp 1/1 Running 0 86m
- The redis cluster has as pre-requisite for the cluster to have persistent storage. For lab setup with external NFS server.
# create PVs
oc create -f 02-redis-pvs.yaml
# example verificaton
oc get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pv1 5Gi RWO Retain Available slow 10m
pv2 5Gi RWO Retain Available slow 10m
pv3 5Gi RWO Retain Available slow 10m
pv4 5Gi RWO Retain Available slow 10m
pv5 5Gi RWO Retain Available slow 10m
pv6 5Gi RWO Retain Available slow 10m
- Deploy redis cluster in
redis-cluster
namespace
# create CR definition
oc create -f 03-redis-cluster.yaml
# NOTE: it will bring one leader and follower at a time and
# only when those are sync, it will proceed with the next one.
# It may take several minutes for all the pods to become available.
# Sample validation
oc get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
redis-cluster-follower-redis-cluster-follower-0 Bound pv2 5Gi RWO slow 22m
redis-cluster-follower-redis-cluster-follower-1 Bound pv1 5Gi RWO slow 22m
redis-cluster-follower-redis-cluster-follower-2 Bound pv4 5Gi RWO slow 21m
redis-cluster-leader-redis-cluster-leader-0 Bound pv5 5Gi RWO slow 22m
redis-cluster-leader-redis-cluster-leader-1 Bound pv6 5Gi RWO slow 22m
redis-cluster-leader-redis-cluster-leader-2 Bound pv3 5Gi RWO slow 21m
oc get pods
NAME READY STATUS RESTARTS AGE
redis-cluster-follower-0 2/2 Running 0 23m
redis-cluster-follower-1 2/2 Running 0 22m
redis-cluster-follower-2 2/2 Running 0 22m
redis-cluster-leader-0 2/2 Running 0 23m
redis-cluster-leader-1 2/2 Running 0 22m
redis-cluster-leader-2 2/2 Running 0 22m