jw-s/redis-operator

Why does the sentinel in function GetMasterIPByName get the vip of k8s svc?

AllenZMC opened this issue · 0 comments

Why does the sentinel in function GetMasterIPByName get the virtual ip of svc?
Look at the following logs

127.0.0.1:26379> SENTINEL get-master-addr-by-name redis-default
1) "10.102.87.230"
2) "6379"

kubectl get svc  -owide
NAME                           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE     SELECTOR
redis-master-redis-default     ClusterIP   10.102.87.230   <none>        6379/TCP    2m59s   <none>

And why is the number of slaves sent by the sentinel is not correct, the pod ip that is killed will be treated as slave ip? There are only three salve, but the sentinel thinks there are five, including the pod ip that was killed and virtual ip of svc.

127.0.0.1:26379> SENTINEL master redis-default
31) "num-slaves"
32) "5"
33) "num-other-sentinels"
34) "2"

kubectl get po -n redis-operator
NAME                                            READY   STATUS    RESTARTS   AGE
redis-redis-operator-7cf575c7d9-4lbs9           1/1     Running   0          19m
redis-sentinel-redis-default-79d489c85c-476dr   1/1     Running   0          17m
redis-sentinel-redis-default-79d489c85c-lg9bp   1/1     Running   0          17m
redis-sentinel-redis-default-79d489c85c-s9qfw   1/1     Running   0          17m
redis-slave-redis-default-0                     1/1     Running   0          17m
redis-slave-redis-default-1                     1/1     Running   0          9m24s
redis-slave-redis-default-2                     1/1     Running   0          11m