Redis-Sentinel Sidecar Pattern Hands-on Guide on Kubernetes ②


Setup (create Pods)

1. Apply YAML files in order

1. Create Config

💻 Terminal

2. Create Service

💻 Terminal

3. Create StatefulSet

💻 Terminal

2. Verify Redis-Sentinel topology

1) Redis role check: ROLE

💻 Terminal

2) Check redis.conf

📄 redis.conf

3) Check sentinel.conf

📄 sentinel.conf

4) Check sentinel monitoring

Run `info sentinel` on Sentinel-0,1,2. Summary of the result:
kubectl exec -it redis-sentinel-0 -c sentinel -- redis-cli -p 28504 -a password info sentinel

💻 Terminal

5) 🖧 Redis-Sentinel node diagram

┌───────────────┐ │ Redis-0(106) │ │ 🟢Master │ │ Sentinel-0 │ └──────┬────────┘ ┌──────────└───────────┐ ▼ ▼ ┌───────────────┐ ┌───────────────┐ │ Redis-1(108) │ │ Redis-2(110) │ │ 🟡Replica-1 │ │ 🟡Replica-2 │ │ Sentinel-1 │ │ Sentinel-2 │ └───────────────┘ └───────────────┘

3. 💽 Load data

If you delete Redis-0 for a failover test, Kubernetes recreates it within about 2 seconds. down-after-milliseconds is 3 seconds, so Sentinel may not notice the outage. Load about 3 million keys so restart takes 5+ seconds (AOF load ~5s).

💻 Terminal

redis-benchmark generates random keys, so dbsize is a bit under 3 million.
- Actual keys: 2955238
- AOF size: aof.1.incr.aof -> 412M
- Pod memory: kubectl top pod -> 625Mi


➡ Pods are up and data is loaded. Next: failover testing.


<< K8s Sidecar Pattern Prep ① K8s Sidecar Pattern Test ③ >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.