KubeBlocks
BlogsEnterprise
⌘K
​
Blogs
Overview
Quickstart

Topologies

Redis Standalone Cluster
Redis Replication Cluster
Redis Sharding Cluster
Architecture

Operations

Lifecycle Management
Vertical Scaling
Horizontal Scaling
Volume Expansion
Manage Redis Services
Modify Redis Parameters
Redis Switchover
Decommission Redis Replica

Backup And Restores

Create BackupRepo
Create Full Backup
Scheduled Backups
Scheduled Continuous Backup
Restore Redis Cluster
Restore with PITR

Custom Secret

Custom Password

Monitoring

Observability for Redis Clusters
FAQs

tpl

  1. Resource Hierarchy
  2. Containers Inside Each Pod
    1. Redis Data Pods
    2. Redis Sentinel Pods
  3. High Availability via Redis Sentinel
  4. Traffic Routing
  5. Automatic Failover
  6. System Accounts

Redis High Availability Architecture in KubeBlocks

This page describes how KubeBlocks deploys a Redis Sentinel cluster on Kubernetes — covering the resource hierarchy, pod internals for both data and Sentinel pods, Sentinel-based HA, traffic routing, and automatic failover.

Resource Hierarchy

KubeBlocks models a Redis cluster as a hierarchy of Kubernetes custom resources:

Cluster  →  Component  →  InstanceSet  →  Pod × N
ResourceRole
ClusterUser-facing declaration — specifies topology, replica count, storage size, and resources
ComponentGenerated automatically; one Component for Redis data pods and one for Sentinel pods; each references its own ComponentDefinition
InstanceSetKubeBlocks custom workload (replaces StatefulSet); manages pods with stable identities and role awareness
PodActual running Redis or Sentinel process; each pod gets a unique ordinal and (for data pods) its own PVC

A Redis Sentinel deployment consists of two KubeBlocks Components within the same Cluster: the Redis data component (primary + replicas) and the Redis Sentinel component (monitoring processes). At least 3 Sentinel pods are required to form a quorum.

Containers Inside Each Pod

Redis Data Pods

ContainerPortPurpose
redis6379 (Redis protocol)Redis data server; the primary accepts writes and replicates to secondaries via async replication
kbagent5001Role probe endpoint — KubeBlocks queries GET /v1.0/getrole every second to identify primary vs. replica
metrics-exporter9187Prometheus metrics exporter

Each data pod mounts its own PVC for the Redis data directory (/data), preserving RDB snapshots and AOF logs across pod restarts.

Redis Sentinel Pods

ContainerPortPurpose
sentinel26379 (Sentinel protocol)Redis Sentinel process that monitors the Redis primary, detects failures, and coordinates failover
kbagent5001Health probe endpoint

Sentinel pods use an emptyDir for their working directory — Sentinel configuration is rebuilt on restart from the current cluster state.

High Availability via Redis Sentinel

Redis Sentinel is a distributed monitoring and automatic failover system for Redis:

Sentinel ConceptDescription
MonitoringEach Sentinel continuously pings the Redis primary and all replicas to detect failures
Subjective down (SDOWN)A Sentinel marks a node as subjectively down when it fails to respond within down-after-milliseconds
Objective down (ODOWN)A primary is declared objectively down when a quorum of Sentinels agree it is unreachable
Leader electionSentinels elect one of themselves as the failover coordinator using a Raft-based voting process
FailoverThe elected Sentinel promotes the most up-to-date replica to primary and reconfigures other replicas to follow the new primary
QuorumTypically (N/2 + 1) Sentinels must agree to trigger a failover; 3 Sentinels require 2 to agree

Traffic Routing

KubeBlocks creates services for both the Redis data component and the Sentinel component:

ServiceTypePortSelector
{cluster}-redisClusterIP6379kubeblocks.io/role=primary
{cluster}-redis-headlessHeadless6379all Redis data pods
{cluster}-redis-sentinelClusterIP26379all Sentinel pods
{cluster}-redis-sentinel-headlessHeadless26379all Sentinel pods

The key mechanism is roleSelector: primary on the Redis ClusterIP service. KubeBlocks probes each data pod via kbagent every second and updates the pod label kubeblocks.io/role. The service Endpoints always point at the current primary — no VIP or external load balancer required.

  • Write traffic: connect to {cluster}-redis:6379
  • Replica access (read scaling): use the headless service DNS {pod-name}.{cluster}-redis-headless.{namespace}.svc.cluster.local:6379
  • Sentinel queries (for client-side Sentinel discovery): connect to {cluster}-redis-sentinel:26379

Automatic Failover

When the Redis primary pod fails, the following sequence restores write access automatically:

  1. Primary stops responding — Sentinels detect the missing ping responses within down-after-milliseconds (default 5 s)
  2. Quorum agreement (ODOWN) — the configured quorum of Sentinels agree the primary is objectively down
  3. Sentinel leader election — Sentinels elect one of themselves as the failover coordinator
  4. Replica selection — the coordinator chooses the replica with the smallest replication lag (most up-to-date)
  5. Promotion — the coordinator sends SLAVEOF NO ONE to the chosen replica, making it the new primary
  6. Reconfiguration — other replicas and Sentinels are informed of the new primary and update their configuration
  7. KubeBlocks detects role change — kbagent returns primary for the new winner; the kubeblocks.io/role=primary label is applied
  8. Service Endpoints switch — the ClusterIP service automatically routes traffic to the new primary

Total failover time is typically within 10–30 seconds, bounded by the down-after-milliseconds setting and the Sentinel quorum agreement time.

For a planned switchover, KubeBlocks calls the Sentinel SENTINEL FAILOVER command via kbagent, which performs a graceful promotion of a chosen replica.

System Accounts

KubeBlocks automatically manages the following Redis system account. The password is auto-generated and stored in a Secret named {cluster}-{component}-account-default.

AccountRolePurpose
defaultAdminDefault Redis authentication account; used for all client connections and inter-component communication (data pods, Sentinel, kbagent)

© 2026 KUBEBLOCKS INC