redis
In-memory data structure store - cache, database, and message broker
About this chart
Redis Helm Chart
Redis is an open-source, in-memory data structure store used as a database, cache, message broker, and streaming engine.
⚠️ Production Consideration
For production environments requiring high availability, consider using Spotahome Redis Operator instead:
- ✅ Automatic failover with Sentinel
- ✅ Master-Replica replication
- ✅ Self-healing capabilities
- ✅ CRD-based management
See Redis Operator Migration Guide for detailed comparison and migration instructions.
This chart is recommended for:
- Development/testing environments
- Simple cache servers
- Single-application deployments
- Resource-constrained environments
Features
- ✅ StatefulSet-based deployment for data persistence
- ✅ Master-Slave replication (1 master + N read-only replicas)
- ✅
modeselector (standalone/replica) with validation; Sentinel/Cluster explicitly blocked until implemented - ✅ Customizable redis.conf configuration file
- ✅ Password authentication support
- ✅ Persistent volume for data storage
- ✅ Prometheus metrics exporter (optional sidecar)
- ✅ ServiceMonitor for Prometheus Operator
- ✅ Liveness, readiness, and startup probes
- ✅ Resource limits and requests
- ✅ Security context (non-root user)
- ✅ Horizontal Pod Autoscaling (optional, not recommended for stateful)
- ✅ Pod Disruption Budget for HA
Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
- PersistentVolume provisioner support in the underlying infrastructure
Modes
mode: standalone(default): Single instance, usesreplicaCount.mode: replica: 1 primary + N replicas, usesreplication.replicas(manual failover).replication.replicas: 0is allowed (master only) but keeps replica-ready services/config in place.mode: sentinel/mode: cluster: Not implemented yet. The chart now fails fast if selected; use Redis Operator or Bitnami charts instead.- Backward compatibility:
replication.enabled=truestill works and maps tomode: replica, butmodeis the preferred switch going forward.
Deployment Scenarios
This chart includes three pre-configured deployment scenarios optimized for different use cases:
Home Server (values-home-single.yaml)
Minimal resources for personal servers, home labs, Raspberry Pi, or Intel NUC:
helm install redis-home charts/redis \
-f charts/redis/values-home-single.yaml \
--set redis.password=your-secure-password
Resource allocation: 50-250m CPU, 128-512Mi RAM, 5Gi storage
Startup Environment (values-startup-single.yaml)
Balanced configuration for small teams, startups, and development environments:
helm install redis-startup charts/redis \
-f charts/redis/values-startup-single.yaml \
--set redis.password=your-secure-password
Resource allocation: 100-500m CPU, 256Mi-1Gi RAM, 10Gi storage
Production HA (values-prod-master-replica.yaml)
High availability deployment with master-replica replication and monitoring:
helm install redis-prod charts/redis \
-f charts/redis/values-prod-master-replica.yaml \
--set redis.password=your-secure-password
Features: 3 replicas (1 master + 2 read replicas), pod anti-affinity, PodDisruptionBudget, ServiceMonitor
Resource allocation: 250m-2000m CPU, 512Mi-2Gi RAM, 20Gi storage per pod
For detailed comparison and configuration examples, see the Scenario Values Guide.
Installation
1. Basic Installation
helm install my-redis ./charts/redis
2. With Password Authentication
Create a my-values.yaml file:
redis:
password: "your-secure-password"
persistence:
enabled: true
size: 8Gi
Install with custom values:
helm install my-redis ./charts/redis -f my-values.yaml
2b. Reusing an Existing Secret
If you already manage the Redis password through your own Secret, create it first (the key defaults to redis-password):
kubectl create secret generic redis-auth --from-literal=redis-password='super-secure'
Then reference it from the chart:
redis:
existingSecret: redis-auth
# secretKeyName: custom-key # Optional, defaults to redis-password
The chart will skip creating a Secret and will mount the referenced one instead.
3. Production Deployment
See values-example.yaml for production-ready configuration with:
- Password authentication
- Persistence enabled
- Resource limits
- Monitoring enabled
helm install my-redis ./charts/redis -f values-example.yaml
Configuration
Redis Configuration
The chart allows full customization of redis.conf:
redis:
password: "secure-password"
config: |
maxmemory 512mb
maxmemory-policy allkeys-lru
appendonly yes
save 900 1
save 300 10
Persistence
Configure persistent storage:
persistence:
enabled: true
storageClass: "fast-ssd"
size: 20Gi
accessMode: ReadWriteOnce
Monitoring
Enable Prometheus metrics:
monitoring:
enabled: true
serviceMonitor:
enabled: true
interval: 30s
metrics:
enabled: true
Master-Slave Replication
Enable read-only replicas for scaling read operations:
mode: replica
replication:
replicas: 2 # Number of read-only replicas (in addition to 1 master). Use 0 for master-only with replica wiring.
This creates:
- 1 master pod (read/write)
- N replica pods (read-only)
- Service endpoints:
redis.{namespace}.svc.cluster.local→ Master (for writes)redis-master.{namespace}.svc.cluster.local→ Master explicitly
- Individual replica access via StatefulSet DNS:
redis-1.redis-headless.{namespace}.svc.cluster.local→ Replica 1redis-2.redis-headless.{namespace}.svc.cluster.local→ Replica 2
Use cases:
- Scale read operations across multiple replicas
- Reduce load on master for read-heavy workloads
- Basic data redundancy (manual failover only)
- Choose specific replica for read operations
Important notes:
- ⚠️ Manual failover only - no automatic master promotion
- ⚠️ For automatic failover, use Redis Operator with Sentinel
- ✅ Each replica has its own persistent volume
- ✅ Password authentication is synced via
masterauth - Backward compatibility:
replication.enabled=trueis still accepted; when set, the chart treats it asmode: replica.
Monitoring replication:
# Check replication status
make -f make/ops/redis.mk redis-replication-info
# Check master status
make -f make/ops/redis.mk redis-master-info
# Check replica lag
make -f make/ops/redis.mk redis-replica-lag
# Check specific pod role
make -f make/ops/redis.mk redis-role POD=redis-0
High Availability
Protect Redis during cluster maintenance and enable security isolation:
# Pod Disruption Budget - prevents data loss during maintenance
podDisruptionBudget:
enabled: true
minAvailable: 1 # For StatefulSet, ensure at least 1 pod is always available
# Network Policy - restricts network access
networkPolicy:
enabled: true
ingress:
- from:
- namespaceSelector:
matchLabels:
name: production
- podSelector:
matchLabels:
app: backend # Only allow access from backend pods
ports:
- protocol: TCP
port: 6379
Pod Disruption Budget Benefits:
- Prevents all Redis pods from being drained simultaneously
- Ensures data availability during node maintenance
- Critical for StatefulSet deployments
Network Policy Benefits:
- Restricts Redis access to authorized clients only
- Provides network-level security isolation
- Complements authentication for defense-in-depth
Common Use Cases
1. Cache Server
redis:
config: |
maxmemory 2gb
maxmemory-policy allkeys-lru
appendonly no
save ""
resources:
limits:
cpu: 1000m
memory: 2.5Gi
requests:
cpu: 500m
memory: 2Gi
2. Persistent Database
redis:
config: |
appendonly yes
appendfsync everysec
save 900 1
save 300 10
save 60 10000
persistence:
enabled: true
size: 20Gi
3. Session Store
redis:
password: "session-secret"
config: |
maxmemory 1gb
maxmemory-policy volatile-lru
timeout 300
Accessing Redis
From Within the Cluster
# With password
kubectl run redis-client --rm -it --restart='Never' \
--image redis:7.4.1-alpine -- \
redis-cli -h my-redis -a your-password
# Without password
kubectl run redis-client --rm -it --restart='Never' \
--image redis:7.4.1-alpine -- \
redis-cli -h my-redis
Port Forward
kubectl port-forward svc/my-redis 6379:6379
redis-cli -h 127.0.0.1 -p 6379
Monitoring
Redis Metrics
When metrics are enabled, Prometheus metrics are exposed at:
http://<pod-ip>:9121/metrics
Key metrics include:
redis_connected_clients- Number of connected clientsredis_used_memory_bytes- Memory used by Redisredis_commands_processed_total- Total commands processedredis_keyspace_hits_total/redis_keyspace_misses_total- Cache hit/miss rate
Redis CLI Monitoring
# Monitor commands in real-time
kubectl exec -it my-redis-0 -- redis-cli monitor
# Get server info
kubectl exec -it my-redis-0 -- redis-cli info
# Check memory usage
kubectl exec -it my-redis-0 -- redis-cli info memory
Backup & Recovery
This chart provides comprehensive backup and recovery procedures for Redis data, configuration, and disaster recovery.
Backup Strategy
The chart implements a 4-component backup strategy:
- Configuration Backup: Redis configuration and Kubernetes manifests
- RDB Snapshots: Point-in-time binary snapshots
- AOF Persistence: Append-only file for durability
- Replication: Hot standby via primary-replica architecture
RTO/RPO Targets:
- Recovery Time Objective (RTO): < 1 hour
- Recovery Point Objective (RPO): 24 hours (daily backups)
Quick Backup Commands
# Full backup (RDB + AOF + Config)
make -f make/ops/redis.mk redis-full-backup
# RDB snapshot only
make -f make/ops/redis.mk redis-backup-rdb
# AOF backup only
make -f make/ops/redis.mk redis-backup-aof
# Configuration backup
make -f make/ops/redis.mk redis-backup-config
Quick Recovery Commands
# Restore from RDB backup
make -f make/ops/redis.mk redis-restore-rdb BACKUP_FILE=tmp/redis-backups/redis-rdb-20250101-120000.rdb
# Restore from AOF backup
make -f make/ops/redis.mk redis-restore-aof BACKUP_FILE=tmp/redis-backups/redis-aof-20250101-120000.aof
# Restore configuration
make -f make/ops/redis.mk redis-restore-config BACKUP_FILE=tmp/redis-backups/redis-config-20250101-120000.conf
Disaster Recovery
# Complete cluster loss - restore from backups
make -f make/ops/redis.mk redis-disaster-recovery BACKUP_DIR=tmp/redis-backups/20250101-120000
# Replica promotion (manual failover)
make -f make/ops/redis.mk redis-promote-replica POD=redis-1
Advanced Backup Features
Automated Backups (via CronJob):
# Not implemented in this chart - use external backup solutions
# Examples: Velero, Kasten K10, or custom CronJob with Makefile targets
PVC Snapshots (for disaster recovery):
# Create VolumeSnapshot
make -f make/ops/redis.mk redis-create-pvc-snapshot
# Restore from VolumeSnapshot
make -f make/ops/redis.mk redis-restore-from-pvc-snapshot SNAPSHOT_NAME=redis-snapshot-20250101
Best Practices:
- Enable both RDB and AOF for maximum durability
- Schedule daily RDB backups (automated via external tools)
- Enable replication for hot standby
- Store backups offsite (S3, MinIO, NFS)
- Test recovery procedures regularly (quarterly recommended)
- Implement 3-2-1 backup rule (3 copies, 2 storage types, 1 offsite)
For detailed backup procedures, disaster recovery scenarios, and troubleshooting, see the comprehensive Redis Backup Guide.
Security & RBAC
This chart implements comprehensive security features including RBAC, network policies, and authentication.
RBAC Configuration
The chart creates namespace-scoped RBAC resources for Redis pods:
# Enable RBAC (default: true)
rbac:
create: true
annotations: {}
RBAC Resources Created:
- Role: Namespace-scoped permissions for Redis operations
- RoleBinding: Binds the Role to the Redis ServiceAccount
- ServiceAccount: Identity for Redis pods
Permissions Granted:
get,list,watchon ConfigMaps (configuration access)get,list,watchon Secrets (credentials access)get,list,watchon Pods (health checks, operations)get,list,watchon Endpoints (service discovery)get,list,watchon PersistentVolumeClaims (storage operations)
RBAC Best Practices:
- Keep
rbac.create: truein production (least-privilege principle) - Use separate ServiceAccounts for different Redis instances
- Audit RBAC permissions regularly
- Never grant cluster-wide permissions to Redis
Authentication & Authorization
Password Authentication:
# Method 1: Inline password (development only)
redis:
password: "your-secure-password"
# Method 2: Existing Secret (recommended for production)
redis:
existingSecret: "redis-auth"
secretKeyName: "redis-password" # Default key name
Create Secret for Production:
# Generate strong random password
REDIS_PASSWORD=$(openssl rand -base64 32)
# Create Kubernetes Secret
kubectl create secret generic redis-auth \
--from-literal=redis-password="${REDIS_PASSWORD}" \
-n redis
**R
Deploy redis with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has redis on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartredis is pinned at v0.4.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply