redis

by cagriekin

Helm chartv1.5.3App 8.8.1Verified publisher

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 replication and 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)

ServicePortPurpose
<release>-redis-sentinel26379Client entry point. Sentinel discovery (get-master-addr-by-name).
<release>-redis-headless6379/26379Stable per-pod DNS for replication + Sentinel gossip.
<release>-redis6379Plain 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-0 seeds 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 1 makes the master refuse writes when it has no healthy replica, shrinking the data-loss window on failover.

RTO / RPO

MetricValueNotes
Failover RTO~downAfterMilliseconds + a few sSentinel detects + promotes (default ~5-15s).
RPO (steady-state failover)secondsAsync replication; bounded by min-replicas-to-write + Sentinel picking the most up-to-date replica.
RPO (full-cluster cold boot)up to last-master deltapod-0 is seeded master; if it was not the last master, un-replicated writes can be lost. See Known limitations.
Standalone RTO~30-90sPod restart + AOF replay.

Configuration

Architecture & replication

ParameterDescriptionDefault
architecturestandalone or replicationreplication
clusterDomainCluster DNS domain for per-pod FQDNscluster.local
redis.replicaCountNumber of replicas (total pods = +1). Replication needs ≥2.2
redis.config.min-replicas-to-writeMaster refuses writes below this many replicas1
redis.config.min-replicas-max-lagMax replica lag (s) to count toward the above10
redis.config.replica-read-onlyReplicas reject writesyes

Sentinel

ParameterDescriptionDefault
sentinel.masterNameSentinel master group namemymaster
sentinel.quorumSentinels that must agree to fail over (empty = strict majority)""
sentinel.downAfterMillisecondsTime before a master is considered down5000
sentinel.failoverTimeoutFailover timeout (ms)60000
sentinel.parallelSyncsReplicas reconfigured in parallel during failover1
sentinel.image.* / sentinel.resourcesSentinel image (reuses redis) / resourcesredis image

Auth & TLS

ParameterDescriptionDefault
redis.auth.enabledRequire a passwordtrue
redis.auth.existingSecret.nameBYO Secret; empty = chart generates one""
redis.auth.existingSecret.keyPassword keyredis-password
sentinel.auth.existingSecret.nameSeparate Sentinel password (empty = reuse redis)""
tls.enabledTLS-only Redis + Sentinel + replicationfalse
tls.existingSecretSecret with tls.crt, tls.key, ca.crt""
tls.clientCertAuthRequire 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.

ParameterDescriptionDefault
redis.auth.acl.enabledEnable ACL usersfalse
redis.auth.acl.operatorUserPrivileged identity the chart authenticates asdefault
redis.auth.acl.operatorPasswordSecret.name / .keyOperator password source (empty = reuse the redis auth Secret)""
redis.auth.acl.users[].nameACL username (^[A-Za-z0-9_.-]+$)—
redis.auth.acl.users[].rulesPermission tokens only (no on/password)""
redis.auth.acl.users[].passwordSecret.name / .keyPer-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

ParameterDescriptionDefault
redis.affinityOverride; empty = hard per-node anti-affinity + soft zone spread{}
redis.topologySpreadConstraintsExtra spread constraints[]
redis.nodeSelector / redis.tolerations / redis.priorityClassNameScheduling{} / [] / ""
redis.podDisruptionBudget.enabledEnable PDBtrue
redis.podDisruptionBudget.maxUnavailableMax unavailable (preserves quorum)1
networkPolicy.enabledEnable NetworkPoliciestrue
networkPolicy.allowExternalAllow ingress from any pod in the namespacetrue
networkPolicy.extraIngress / extraEgressAdditional rules (rule-level)[]

Image, persistence, resources, exporter

ParameterDescriptionDefault
redis.image.repository / redis.image.tagRedis imageredis / 8.8.1-trixie
redis.persistence.enabled / size / storageClassPersistencetrue / 1Gi / ""
redis.persistence.retainKeep data PVCs on uninstall / scale-down (false = auto-delete)true
redis.resourcesRequests/limitssee values.yaml
redis.config.maxmemory / maxmemory-policyMemory cap / eviction200mb / allkeys-lru
redis.config.appendfsyncAOF sync (always/everysec/no)everysec
exporter.enabledPrometheus exporter (sidecar in replication)true
exporter.podAnnotationsAnnotations on the standalone exporter pod (e.g. prometheus.io/scrape); use redis.podAnnotations in replication{}
exporter.serviceMonitor.enabled / exporter.prometheusRule.enabledServiceMonitor / alertstrue / false
exporter.serviceMonitor.interval / scrapeTimeoutPrometheus scrape interval / timeout30s / 10s
exporter.connectionTimeoutGo-duration connect timeout to Redis (empty = exporter default 15s)""
exporter.logFormatExporter log format: txt (logfmt) or jsontxt
exporter.includeConfigMetricsInclude CONFIG GET key metricsfalse
exporter.includeSystemMetricsInclude system-level metrics from INFO (process cpu/mem)false
exporter.exportClientListExport per-client metrics via CLIENT LIST (expensive)false
exporter.disableExporterMetricsDisable go-runtime metrics from the exporter itselffalse
exporter.extraEnvVarsAdditional env vars for the exporter container (supports value and valueFrom)[]
exporter.dashboards.enabledShip the Grafana dashboard as a sidecar-discoverable ConfigMapfalse
exporter.dashboards.label / labelValueLabel the Grafana sidecar watches forgrafana_dashboard / "1"
exporter.dashboards.namespaceConfigMap namespace (empty = release namespace)""
exporter.dashboards.additionalLabels / annotationsExtra 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartredis is pinned at v1.5.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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