skills/kubeblocks-addon-redis/SKILL.md
Deploy and manage Redis clusters on KubeBlocks with topology selection guidance. Supports standalone (dev/test), replication with Sentinel (HA), and Redis Cluster sharding (horizontal scaling) topologies. Use when the user mentions Redis, cache, in-memory store, or explicitly wants to create a Redis cluster. Provides topology comparison, best-practice defaults, and connection methods. For generic cluster creation across all engines, see kubeblocks-create-cluster. For Day-2 operations (scaling, backup, etc.), use the corresponding operation skill.
npx skillsauth add apecloud/kubeblocks-skills kubeblocks-addon-redisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deploy Redis on Kubernetes using KubeBlocks. Three topologies are available: standalone for development, replication with Sentinel for HA, and Redis Cluster for horizontal sharding.
Official docs: https://kubeblocks.io/docs/preview/user_docs/kubeblocks-for-redis/cluster-management/create-and-connect-a-redis-cluster Full doc index: https://kubeblocks.io/llms-full.txt
# Check if redis addon is installed
helm list -n kb-system | grep redis
# Install if missing
helm install kb-addon-redis kubeblocks/redis --namespace kb-system --version 1.0.0
| Topology | clusterDef | topology | Components | Use Case |
|---|---|---|---|---|
| Standalone | redis | standalone | redis (1 replica) | Dev/test, no HA needed |
| Replication | redis | replication | redis (2+) + redis-sentinel (3) | Production HA |
| Sharding | N/A | N/A | Uses spec.shardings with componentDef redis-cluster-7 | Horizontal scaling |
Important: The sharding topology uses spec.shardings instead of spec.componentSpecs. This is a fundamentally different spec structure.
| Version | serviceVersion |
|---|---|
| Redis 7.0 | 7.0.6 |
| Redis 7.2 | 7.2.4 |
- [ ] Step 1: Ensure addon is installed
- [ ] Step 2: Create namespace
- [ ] Step 3: Create cluster (choose topology)
- [ ] Step 4: Wait for cluster to be ready
- [ ] Step 5: Connect to Redis
helm list -n kb-system | grep redis
If not found:
helm install kb-addon-redis kubeblocks/redis --namespace kb-system --version 1.0.0
kubectl create namespace demo --dry-run=client -o yaml | kubectl apply -f -
Simplest setup, single Redis instance. Good for development:
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: redis-standalone
namespace: demo
spec:
clusterDef: redis
topology: standalone
terminationPolicy: Delete
componentSpecs:
- name: redis
serviceVersion: "7.2.4"
replicas: 1
resources:
limits: {cpu: "0.5", memory: "0.5Gi"}
requests: {cpu: "0.5", memory: "0.5Gi"}
volumeClaimTemplates:
- name: data
spec:
accessModes: [ReadWriteOnce]
resources: {requests: {storage: 20Gi}}
Production-ready HA setup. Sentinel monitors the primary and performs automatic failover:
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: redis-replication
namespace: demo
spec:
clusterDef: redis
topology: replication
terminationPolicy: Delete
componentSpecs:
- name: redis
serviceVersion: "7.2.4"
replicas: 2
resources:
limits: {cpu: "0.5", memory: "0.5Gi"}
requests: {cpu: "0.5", memory: "0.5Gi"}
volumeClaimTemplates:
- name: data
spec:
accessModes: [ReadWriteOnce]
resources: {requests: {storage: 20Gi}}
- name: redis-sentinel
serviceVersion: "7.2.4"
replicas: 3
resources:
limits: {cpu: "0.2", memory: "256Mi"}
requests: {cpu: "0.2", memory: "256Mi"}
volumeClaimTemplates:
- name: data
spec:
accessModes: [ReadWriteOnce]
resources: {requests: {storage: 20Gi}}
Key points:
redis component has 2+ replicas (1 primary + replicas, managed by Sentinel)redis-sentinel component needs 3 replicas for quorumFor horizontal scaling with data sharding. This topology uses spec.shardings instead of spec.componentSpecs:
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: redis-cluster
namespace: demo
spec:
terminationPolicy: Delete
shardings:
- name: shard
shards: 3
template:
name: redis-shard
componentDef: redis-cluster-7
serviceVersion: "7.2.4"
replicas: 2
resources:
limits: {cpu: "0.5", memory: "0.5Gi"}
requests: {cpu: "0.5", memory: "0.5Gi"}
volumeClaimTemplates:
- name: data
spec:
accessModes: [ReadWriteOnce]
resources: {requests: {storage: 20Gi}}
Key points:
spec.shardings — NOT spec.componentSpecsshards: 3 creates 3 shards (minimum recommended)replicas: 2 (1 primary + 1 replica per shard)componentDef: redis-cluster-7 (not clusterDef)clusterDef or topology at the cluster levelkubectl -n demo get cluster <cluster-name> -w
Wait until STATUS shows Running.
Check pods:
kubectl -n demo get pods -l app.kubernetes.io/instance=<cluster-name>
# Secret name format: <cluster>-redis-account-default
kubectl -n demo get secret redis-standalone-redis-account-default -o jsonpath='{.data.password}' | base64 -d
# Standalone / Replication
kubectl -n demo exec -it redis-standalone-redis-0 -- redis-cli
# Redis Cluster (use -c flag for cluster mode)
kubectl -n demo exec -it redis-cluster-shard-ckvks-0 -- redis-cli -c
kubectl -n demo port-forward svc/redis-standalone-redis 6379:6379
# Then from another terminal:
redis-cli -h 127.0.0.1 -p 6379
Cluster stuck in Creating:
kubectl -n demo describe cluster <cluster-name>
kubectl -n demo get events --sort-by='.lastTimestamp'
Sentinel failover issues:
kubectl -n demo exec -it redis-replication-redis-sentinel-0 -- redis-cli -p 26379 SENTINEL masters
Redis Cluster slots not assigned:
kubectl -n demo exec -it <any-shard-pod> -- redis-cli -c CLUSTER INFO
| Operation | Skill | External Docs | |---|---|---| | Stop / Start / Restart | cluster-lifecycle | Docs | | Scale CPU / Memory | vertical-scaling | Docs | | Add / Remove replicas | horizontal-scaling | Docs | | Expand storage | volume-expansion | Docs | | Change parameters | reconfigure-parameters | Docs | | Expose externally | expose-service | Docs | | Backup | backup | Docs | | Restore | restore | Docs |
Follow safety-patterns.md for dry-run before apply, status confirmation after watch, and pre-deletion checklist.
devops
Expand persistent volume storage for KubeBlocks database clusters via OpsRequest. Requires the StorageClass to support volume expansion (allowVolumeExpansion=true). Use when the user needs more disk space, wants to increase storage, expand volumes, or resize PVCs. NOT for changing CPU/memory (see vertical-scaling) or adding more replicas (see horizontal-scaling). Note that volume shrinking is not supported by Kubernetes.
data-ai
Scale CPU and memory resources for KubeBlocks database clusters via OpsRequest (vertical scaling). Supports in-place updates when the feature gate is enabled. Use when the user wants to change, increase, decrease, resize, or adjust CPU or memory resources of a database cluster. NOT for adding/removing replicas or shards (see horizontal-scaling) or expanding disk storage (see volume-expansion).
data-ai
Upgrade the KubeBlocks operator itself via Helm. Covers update operator, upgrade to v1.0, update kubeblocks version, and CRD updates. Use when the user wants to upgrade KubeBlocks, update the operator, or upgrade to a new KubeBlocks release. NOT for upgrading database engine versions (see minor-version-upgrade).
development
Diagnostic guide for KubeBlocks-managed database clusters. Use when the user reports troubleshoot, debug, diagnose, not working, error, failed, stuck, CrashLoopBackOff, cluster exception, or similar problems with their database cluster. This skill guides the agent through diagnostic steps — it does NOT perform actions.