KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​
Overview
Quickstart

Topologies

Redis Standalone Cluster
Redis Replication Cluster
Redis Sharding Cluster

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. Prerequisites
  2. Deploying the Redis Replication Cluster
  3. Verifying the Deployment
    1. Check the Cluster Status
    2. Verify Component and Pod Status
  4. Cleanup

Deploying a Redis Replication Cluster with KubeBlocks

Redis Replication involves a primary (master) node that handles writes and one or more replica (slave) nodes that replicate data from the master for read scaling and failover.

Use Cases

  • Read-heavy applications (e.g., analytics workload).
  • High-availability setups with Redis Sentinel for automatic failover.

Prerequisites

    Before proceeding, ensure the following:

    • Environment Setup:
      • A Kubernetes cluster is up and running.
      • The kubectl CLI tool is configured to communicate with your cluster.
      • KubeBlocks CLI and KubeBlocks Operator are installed. Follow the installation instructions here.
    • Namespace Preparation: To keep resources isolated, create a dedicated namespace for this tutorial:
    kubectl create ns demo namespace/demo created

    Deploying the Redis Replication Cluster

    apiVersion: apps.kubeblocks.io/v1 kind: Cluster metadata: name: redis-replication namespace: demo spec: terminationPolicy: Delete clusterDef: redis topology: replication componentSpecs: - name: redis serviceVersion: "7.2.4" disableExporter: false replicas: 2 resources: limits: cpu: '0.5' memory: 0.5Gi requests: cpu: '0.5' memory: 0.5Gi volumeClaimTemplates: - name: data spec: storageClassName: "" accessModes: - ReadWriteOnce resources: requests: storage: 20Gi - name: redis-sentinel replicas: 3 resources: limits: cpu: '0.5' memory: 0.5Gi requests: cpu: '0.5' memory: 0.5Gi volumeClaimTemplates: - name: data spec: storageClassName: "" accessModes: - ReadWriteOnce resources: requests: storage: 20Gi

    Key Configuration Details:

    • clusterDef: redis: Specifies the ClusterDefinition CR for the cluster.
    • topology: replication: Configures the cluster to use replication topology.
    • componentSpecs: Defines the components in the cluster:
      • Component 'redis':
        • serviceVersion: 7.2.4: Specifies the version of the Redis service to be deployed.
      • Component 'redis-sentinel':
        • Redis Sentinel is a high availability solution for Redis. Recommended to deploy 3 replica for high availability.

    Verifying the Deployment

    Check the Cluster Status

    Once the cluster is deployed, check its status:

    kubectl get cluster redis-replication -n demo -w

    Expected Output:

    NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE redis-replication redis Delete Running 66s

    Verify Component and Pod Status

    kubectl get component redis-replication-redis -n demo

    Expected Output:

    NAME DEFINITION SERVICE-VERSION STATUS AGE redis-replication-redis redis-7-1.0.0 7.2.4 Running 90s

    Check pods and their roles

    kubectl get pods -l app.kubernetes.io/instance=redis-replication -L kubeblocks.io/role -n demo

    Expected Output:

    NAME READY STATUS RESTARTS AGE ROLE redis-replication-redis-0 3/3 Running 0 3m38s primary redis-replication-redis-1 3/3 Running 0 3m16s secondary redis-replication-redis-sentinel-0 2/2 Running 0 4m35s redis-replication-redis-sentinel-1 2/2 Running 0 4m17s redis-replication-redis-sentinel-2 2/2 Running 0 3m59s

    Cleanup

    To remove all resources created during this tutorial:

    kubectl delete cluster redis-replication -n demo kubectl delete ns demo

    © 2025 ApeCloud PTE. Ltd.