redis
by cagriekin
Redis standalone or Sentinel-managed HA replication, with ACLs, TLS, AOF persistence, and a Prometheus metrics exporter
About this chart
Redis Helm Chart
Redis with AOF persistence, in two architectures:
replication(default): a Redis master plus replicas with a Redis Sentinel sidecar in every pod for quorum-based automatic failover. Clients are Sentinel-aware.standalone: a single Redis instance (the pre-1.0.0 behavior).
Optional Prometheus metrics, NetworkPolicy, PodDisruptionBudget and in-transit TLS.
Upgrading from 0.x? 1.0.0 changes the default to
replicationand turns auth and NetworkPolicy on by default. See Migrating to 1.0.0.
Installation
HA replication (default)
helm install cache ./redis
This deploys 3 pods (1 master + 2 replicas), each running a Redis Sentinel sidecar, plus a generated password Secret. Connect Sentinel-aware clients to the Sentinel Service:
host: cache-redis-sentinel:26379 # SENTINEL get-master-addr-by-name mymaster
master name: mymaster
password: kubectl get secret cache-redis -o jsonpath='{.data.redis-password}' | base64 -d
Example (redis-py):
from redis.sentinel import Sentinel
s = Sentinel([("cache-redis-sentinel", 26379)], sentinel_kwargs={"password": PW})
master = s.master_for("mymaster", password=PW) # writes
replica = s.slave_for("mymaster", password=PW) # reads
Standalone (single instance)
helm install cache ./redis --set architecture=standalone
Cloud / multi-zone
helm install cache ./redis -f redis/values-cloud.yaml
Architecture
Services (replication)
| Service | Port | Purpose |
|---|---|---|
<release>-redis-sentinel | 26379 | Client entry point. Sentinel discovery (get-master-addr-by-name). |
<release>-redis-headless | 6379/26379 | Stable per-pod DNS for replication + Sentinel gossip. |
<release>-redis | 6379 | Plain all-pods Service for reads (round-robins to master + replicas). |
Writes must go to the master discovered via Sentinel — the plain <release>-redis
Service does not track the master. Replicas may serve slightly stale reads.
<release>-redis is the chart fullname. Note Helm collapses it to just <release> when
the release name already contains redis (e.g. release my-redis → Services my-redis,
my-redis-sentinel, my-redis-headless). The examples above use release cache so the
<release>-redis-* form is literal.
How failover stays correct
- Stable DNS: every node announces its headless FQDN (
replica-announce-ip,sentinel announce-ip+resolve-hostnames/announce-hostnames), so a pod restarting with a new IP is never tracked at a stale address. - Failover-safe bootstrap: an init container asks the Sentinels who the master is and
joins as its replica before Redis starts, so a restarted ex-master never resurrects
read-write. Only
pod-0seeds as master on a genuine cold boot. - Writable config on tmpfs: Redis and Sentinel rewrite their own config at runtime, so the chart renders config into an in-memory volume (secrets never persist to node disk).
- Write safety:
min-replicas-to-write 1makes the master refuse writes when it has no healthy replica, shrinking the data-loss window on failover.
RTO / RPO
| Metric | Value | Notes |
|---|---|---|
| Failover RTO | ~downAfterMilliseconds + a few s | Sentinel detects + promotes (default ~5-15s). |
| RPO (steady-state failover) | seconds | Async replication; bounded by min-replicas-to-write + Sentinel picking the most up-to-date replica. |
| RPO (full-cluster cold boot) | up to last-master delta | pod-0 is seeded master; if it was not the last master, un-replicated writes can be lost. See Known limitations. |
| Standalone RTO | ~30-90s | Pod restart + AOF replay. |
Configuration
Architecture & replication
| Parameter | Description | Default |
|---|---|---|
architecture | standalone or replication | replication |
clusterDomain | Cluster DNS domain for per-pod FQDNs | cluster.local |
redis.replicaCount | Number of replicas (total pods = +1). Replication needs ≥2. | 2 |
redis.config.min-replicas-to-write | Master refuses writes below this many replicas | 1 |
redis.config.min-replicas-max-lag | Max replica lag (s) to count toward the above | 10 |
redis.config.replica-read-only | Replicas reject writes | yes |
Sentinel
| Parameter | Description | Default |
|---|---|---|
sentinel.masterName | Sentinel master group name | mymaster |
sentinel.quorum | Sentinels that must agree to fail over (empty = strict majority) | "" |
sentinel.downAfterMilliseconds | Time before a master is considered down | 5000 |
sentinel.failoverTimeout | Failover timeout (ms) | 60000 |
sentinel.parallelSyncs | Replicas reconfigured in parallel during failover | 1 |
sentinel.image.* / sentinel.resources | Sentinel image (reuses redis) / resources | redis image |
Auth & TLS
| Parameter | Description | Default |
|---|---|---|
redis.auth.enabled | Require a password | true |
redis.auth.existingSecret.name | BYO Secret; empty = chart generates one | "" |
redis.auth.existingSecret.key | Password key | redis-password |
sentinel.auth.existingSecret.name | Separate Sentinel password (empty = reuse redis) | "" |
tls.enabled | TLS-only Redis + Sentinel + replication | false |
tls.existingSecret | Secret with tls.crt, tls.key, ca.crt | "" |
tls.clientCertAuth | Require client certificates (mutual TLS) | false |
TLS requires architecture: replication (the cert volume, --tls probes and per-pod-FQDN
SAN model are wired into the replication StatefulSet); enabling it with standalone is
rejected at render time. For a standalone instance, terminate TLS at a proxy in front of it.
TLS certificate SANs must cover the per-pod headless FQDNs
(*.<release>-redis-headless.<ns>.svc.<clusterDomain>), the <release>-redis-sentinel
and <release>-redis Service names, and 127.0.0.1/localhost (the in-pod probes), or
peers and probes will fail verification.
The Sentinel port 26379 is the client discovery endpoint, so it is reachable by clients
(in-namespace via allowExternal, cross-namespace via networkPolicy.extraIngress). It is
also Sentinel's admin port — keep redis.auth.enabled: true (the default) so it requires a
password; disabling auth while allowExternal: true leaves cluster reconfiguration open to
any in-namespace pod.
ACL
Redis ACLs layer named, per-command/per-key users on top of the password auth above
(redis.auth.acl, requires redis.auth.enabled). Works in both standalone and
replication.
| Parameter | Description | Default |
|---|---|---|
redis.auth.acl.enabled | Enable ACL users | false |
redis.auth.acl.operatorUser | Privileged identity the chart authenticates as | default |
redis.auth.acl.operatorPasswordSecret.name / .key | Operator password source (empty = reuse the redis auth Secret) | "" |
redis.auth.acl.users[].name | ACL username (^[A-Za-z0-9_.-]+$) | — |
redis.auth.acl.users[].rules | Permission tokens only (no on/password) | "" |
redis.auth.acl.users[].passwordSecret.name / .key | Per-user password source | "" |
redis:
auth:
acl:
enabled: true
users:
- name: app
rules: "~app:* &app:* +@read +@write -@dangerous"
passwordSecret:
key: app-acl-password # empty name => chart generates this key
rules carries permission tokens only — key patterns (~app:*), channel patterns
(&app:*), and command rules (+@read, -@dangerous). The chart emits on and the
password itself, so do not put on/off/nopass/reset*/>password/#hash in
rules (rejected at render time). Pub/sub needs an explicit &<pattern> because Redis
defaults to resetchannels.
Operator user. The chart authenticates as operatorUser for replication
(masteruser/masterauth), Sentinel (auth-user/auth-pass), the exporter, and the
liveness/readiness/preStop probes. Its permissions are chart-managed and always full
(~* &* +@all) — you pick only its name and password source, never its rules, because a
restricted operator silently breaks replication, failover, and metrics. The default
operatorUser: default keeps today's behavior exactly (the default user via
requirepass). To lock down the default user, define it under users[] and set
operatorUser to a separate name — the chart then drops requirepass and renders an
explicit user default line. (Locking down default while it is still the operator is
rejected.)
Passwords. Each user's password comes from a Secret. With an empty passwordSecret.name
the chart generates a random value (key acl-<name>-password unless you set .key) and
persists it across upgrades via lookup. Under render-only pipelines (e.g. ArgoCD) lookup
is empty, so set passwordSecret.name (and operatorPasswordSecret.name) for every ACL
user, or each sync regenerates the passwords and locks out clients — the same caveat as
redis.auth.existingSecret.name.
Runtime changes are not persisted. There is no aclfile; the rendered config is the
source of truth, so ACL SETUSER/ACL SAVE at runtime are lost on restart — change users
through values + helm upgrade. Rotating a password is a deliberate operation: during
the rolling restart a re-elected master may briefly hold the new password while a
not-yet-restarted replica still presents the old masterauth, so rotate during a quiet
window.
Scheduling, PDB, NetworkPolicy
| Parameter | Description | Default |
|---|---|---|
redis.affinity | Override; empty = hard per-node anti-affinity + soft zone spread | {} |
redis.topologySpreadConstraints | Extra spread constraints | [] |
redis.nodeSelector / redis.tolerations / redis.priorityClassName | Scheduling | {} / [] / "" |
redis.podDisruptionBudget.enabled | Enable PDB | true |
redis.podDisruptionBudget.maxUnavailable | Max unavailable (preserves quorum) | 1 |
networkPolicy.enabled | Enable NetworkPolicies | true |
networkPolicy.allowExternal | Allow ingress from any pod in the namespace | true |
networkPolicy.extraIngress / extraEgress | Additional rules (rule-level) | [] |
Image, persistence, resources, exporter
| Parameter | Description | Default |
|---|---|---|
redis.image.repository / redis.image.tag | Redis image | redis / 8.8.1-trixie |
redis.persistence.enabled / size / storageClass | Persistence | true / 1Gi / "" |
redis.persistence.retain | Keep data PVCs on uninstall / scale-down (false = auto-delete) | true |
redis.resources | Requests/limits | see values.yaml |
redis.config.maxmemory / maxmemory-policy | Memory cap / eviction | 200mb / allkeys-lru |
redis.config.appendfsync | AOF sync (always/everysec/no) | everysec |
exporter.enabled | Prometheus exporter (sidecar in replication) | true |
exporter.podAnnotations | Annotations on the standalone exporter pod (e.g. prometheus.io/scrape); use redis.podAnnotations in replication | {} |
exporter.serviceMonitor.enabled / exporter.prometheusRule.enabled | ServiceMonitor / alerts | true / false |
exporter.serviceMonitor.interval / scrapeTimeout | Prometheus scrape interval / timeout | 30s / 10s |
exporter.connectionTimeout | Go-duration connect timeout to Redis (empty = exporter default 15s) | "" |
exporter.logFormat | Exporter log format: txt (logfmt) or json | txt |
exporter.includeConfigMetrics | Include CONFIG GET key metrics | false |
exporter.includeSystemMetrics | Include system-level metrics from INFO (process cpu/mem) | false |
exporter.exportClientList | Export per-client metrics via CLIENT LIST (expensive) | false |
exporter.disableExporterMetrics | Disable go-runtime metrics from the exporter itself | false |
exporter.extraEnvVars | Additional env vars for the exporter container (supports value and valueFrom) | [] |
exporter.dashboards.enabled | Ship the Grafana dashboard as a sidecar-discoverable ConfigMap | false |
exporter.dashboards.label / labelValue | Label the Grafana sidecar watches for | grafana_dashboard / "1" |
exporter.dashboards.namespace | ConfigMap namespace (empty = release namespace) | "" |
exporter.dashboards.additionalLabels / annotations | Extra labels / annotations (e.g. grafana_folder) | {} / {} |
Monitoring
The oliver006/redis_exporter runs as a per-pod sidecar in replication so every member's
role and replication metrics are scraped. Enabling exporter.prometheusRule.enabled adds
HA alerts: RedisDown/RedisNoMaster, RedisMultipleMasters (split-brain),
RedisReplicaDown, RedisReplicationLinkDown, and RedisWritesBlocked (the
min-replicas-to-write tripwire). Standalone keeps the original single-instance alerts.
Annotation-based scrapers
exporter.serviceMonitor.enabled only helps if a Prometheus Operator is watching (and its
serviceMonitorSelector matches — pass exporter.serviceMonitor.additionalLabels such as
release: <prometheus-release> when it does not). Agents that discover targets from pod
annotations instead (Grafana Alloy, plain Prometheus kubernetes_sd_configs with a
prometheus.io/scrape keep rule) need the annotations on the pod:
# standalone: the exporter is its own Deployment
exporter:
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9121"
prometheus.io/path: "/metrics"
# replication: the exporter is a sidecar, so annotate the redis pods
redis:
podAnnotations:
prometheus.io/scrape: "true"
pr
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 v1.5.3 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