Skip to content
lorebow

Step 5 of 9, about 1 min

Check it works

See the pods, their claims and the primary, then write a key and read it back.

#The pods are running

Wait until every pod is Running and every claim is Bound. Replication and Sentinel have three pods, Cluster six, and a shared Sentinel group three plus each service's own:

bash
kubectl -n redis get pods,pvc

#The primary sees its replicas

Ask the primary about its replicas. With Helm the pod is redis-master-0; with YAML it is redis-0.

INFO replication
$ kubectl -n redis exec redis-0 -- redis-cli -a "$PASSWORD" --no-auth-warning INFO replication
# Replication
role:master
connected_slaves:2
slave0:ip=10.42.1.14,port=6379,state=online,offset=1204,lag=0
slave1:ip=10.42.2.9,port=6379,state=online,offset=1204,lag=0

Redis still prints the old names here: master is the primary, and each slave is a replica. role:master and two state=online slaves mean replication is working. Where else the old names appear.

#Write, then read from a replica

Write on the primary, read on a replica (with Helm, redis-master-0 and redis-replicas-0):

bash
kubectl -n redis exec redis-0 -- redis-cli -a "$PASSWORD" --no-auth-warning SET hello world
kubectl -n redis exec redis-1 -- redis-cli -a "$PASSWORD" --no-auth-warning GET hello