Kubernetes Üzerinde Redis Operator, Redis Replication ve Redis Sentinel Kurulumu (OT-Container-Kit Helm Chart)
Kubernetes üzerinde yüksek erişilebilir, otomatik failover destekli bir Redis mimarisi kurmak istiyorsanız OT-Container-Kit Redis Operator size büyük kolaylık sağlar. Bu yazıda:
- Redis Operator
- Redis Replication (Master–Replica mimarisi)
- Redis Sentinel (monitoring + failover)
- Secret yönetimi
- values.yaml örnekleri
gibi temel adımları eksiksiz şekilde göstereceğim.
🎯 Hedef Yapı
Bu kurulum ile:
✔ 3 node Redis Replication
✔ 3 node Redis Sentinel
✔ Otomatik failover
✔ Secret tabanlı şifre yönetimi
✔ Operator tabanlı yönetim
tam anlamıyla production-ready bir Redis cluster elde etmiş olacaksınız.
1️⃣ Helm Repository Ekleme
Öncelikle OT-Container-Kit deposunu ekleyelim:
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/
Repo güncellemesi:
helm repo update
2️⃣ Namespace Oluşturma
Redis bileşenlerini ayrı bir namespace içinde çalıştırmak en doğru yaklaşımdır.
kubectl create namespace ot-redis
3️⃣ Redis Operator Kurulumu
Redis Operator, tüm Redis bileşenlerini yöneten ana kontrol mekanizmasıdır.
helm install redis-operator ot-helm/redis-operator --namespace ot-redis
4️⃣ Redis Şifresi İçin Secret Oluşturma
Redis replication ve sentinel aynı şifreyi kullanmalıdır. Bu yüzden önce secret oluşturuyoruz:
kubectl create secret generic redis-secret \
--from-literal=password='2024#Secure' \
-n ot-redis
5️⃣ Redis Replication (Master–Replica) Kurulumu
Önce values.yaml dosyamızı hazırlıyoruz:
💾 values.yaml
redisReplication:
clusterSize: 3
redisSecret:
secretName: redis-secret
secretKey: password
Kurulum:
helm install redis-replication ot-helm/redis-replication \
--namespace ot-redis \
--values values.yaml
Bu işlem sonucunda:
- 1 Primary (master)
- 2 Replica
- Sağlıklı bir replication topolojisi
oluşur.
6️⃣ Redis Sentinel Kurulumu
Sentinel, replication yapısını izler ve primary node down olursa otomatik failover yapar.
💾 sentinel-values.yaml
redisSentinel:
clusterSize: 3
redisSecret:
secretName: redis-secret
secretKey: password
redisSentinelConfig:
redisReplicationName: "redis-replication"
redisReplicationPassword:
secretName: redis-secret
secretKey: password
Kurulum komutu:
helm install redis-sentinel ot-helm/redis-sentinel \
--namespace ot-redis \
--values sentinel-values.yaml
🎉 Sonuç: Tam Entegre Redis Cluster + Sentinel + Failover
Bu kurulumla Kubernetes üzerinde:
✔ Redis Operator
✔ Redis Replication (3 node)
✔ Redis Sentinel (3 node)
✔ Secret tabanlı güvenli şifre yönetimi
✔ Tam otomatik failover
✔ Üretim ortamına uygun HA mimarisi
başarıyla kurulmuş olur.
Redis Operator sayesinde cluster büyütme, konfigürasyon değiştirme ve bakım işlemleri çok daha kolay hale gelir.