Redis on k3s¶
Overview¶
Runs Redis for cache, rate limiting, locks, or short-lived queues. On a single-node VPS, deploy one instance with bounded memory; Sentinel or replicas on the same host do not protect against host failure.
GitOps Configuration¶
Use a maintained Redis Helm chart and pin its chart version. A minimal values file should include:
architecture: standalone
auth:
existingSecret: redis-auth
existingSecretPasswordKey: password
master:
persistence:
enabled: true
size: 4Gi
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
memory: 512Mi
configuration: |-
maxmemory 384mb
maxmemory-policy allkeys-lru
Choose the eviction policy based on semantics: allkeys-lru is suitable for a cache; use noeviction when silent data eviction is unacceptable. Persistence does not turn Redis into a primary database.
Applications connect through the ClusterIP service, normally redis-master.data.svc.cluster.local:6379. Source the password from the secret manager.
Verification¶
kubectl get pod,pvc,svc -n data
kubectl exec -n data statefulset/redis-master -- redis-cli -a "$REDIS_PASSWORD" PING
kubectl exec -n data statefulset/redis-master -- redis-cli -a "$REDIS_PASSWORD" INFO memory
Monitor used memory, evictions, hit ratio, blocked clients, command latency, and rejected connections.