Deploying a Redis Standalone Cluster with KubeBlocks
A standalone Redis deployment consists of a single Redis server instance running independently without any replication or clustering. It is the simplest and most lightweight deployment model.
Use Cases
Development & testing environments.
Small applications with low traffic.
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.
Namespace Preparation: To keep resources isolated, create a dedicated namespace for this tutorial:
kubectl create ns demo
namespace/demo created
Deploying the Redis Standalone Cluster
apiVersion:apps.kubeblocks.io/v1kind:Clustermetadata:name:redis-standalonenamespace:demospec:terminationPolicy:DeleteclusterDef:redis# set to reidstopology:standalone# set topology to standalonecomponentSpecs:-name:redisreplicas:1# set replica to 1serviceVersion:7.2.4resources:limits:cpu:"0.5"memory:"0.5Gi"requests:cpu:"0.5"memory:"0.5Gi"volumeClaimTemplates:-name:dataspec:accessModes:-ReadWriteOnceresources:requests:storage:20Gi
Key Configuration Details:
clusterDef: redis: Specifies the ClusterDefinition CR for the cluster.
topology: standalone: Configures the cluster to use standalone topology.
componentSpecs: Defines the components in the cluster:
Component 'redis':
serviceVersion: 7.2.4: Specifies the version of the Redis service to be deployed.
Verifying the Deployment
Check the Cluster Status
Once the cluster is deployed, check its status:
kubectl get cluster redis-standalone -n demo -w
Expected Output:
NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
redis-standalone redis Delete Running 34s
Verify Component Status
kubectl get component redis-standalone-redis -n demo
Expected Output:
NAME DEFINITION SERVICE-VERSION STATUS AGE
redis-standalone-redis redis-7-1.0.0 7.2.4 Running 90s
Cleanup
To remove all resources created during this tutorial: