redis
by daviunx
Runs Redis on Kubernetes with Sentinel high availability, automatic failback of the master role, and role-aware readiness so the master Service always points at a node that accepts writes.
About this chart
Redis Helm Chart
Runs Redis on Kubernetes with Sentinel high availability: one master, N replicas, and a Sentinel quorum that promotes a replica when the master stops answering. What sets it apart is what happens next. The master pod reclaims its role once it is healthy again, readiness is role aware so a demoted pod leaves the master Service, and Sentinel keeps its view of the cluster across restarts. It is for teams who want a Sentinel setup that converges back to a known topology without an operator watching it. It is published by Neomanex, an AI-native company, and it is the chart we run our own production Redis on.
helm install redis oci://ghcr.io/neomanexlabs/charts/redis --version 1.1.0 -f my-values.yaml
Add the repository
helm repo add neomanexlabs https://neomanexlabs.github.io/helm-charts
helm repo update
helm install redis neomanexlabs/redis --version 1.1.0 -f my-values.yaml
Both install paths serve the identical package.
Requirements
| Requirement | Detail |
|---|---|
| Kubernetes | 1.25 or newer, with a default StorageClass that supports dynamic provisioning when persistence is enabled |
| External Secrets Operator | Optional. With externalSecrets.enabled: false (the default) the chart manages its own Secret. Turn it on to have the passwords delivered from an external store |
| Prometheus Operator | Optional, and only for metrics.serviceMonitor.enabled. The exporter sidecar itself needs nothing |
| Container image | redis:7.4.2-alpine by default. Any Redis image with redis-cli, redis-sentinel and a shell works |
Quick start
examples/minimal.yaml installs a single standalone instance. examples/ha-sentinel.yaml installs the high availability topology: one master, two replicas, three Sentinels, the metrics exporter, and a configuration that refuses writes while no replica is connected.
helm template redis neomanexlabs/redis -f examples/ha-sentinel.yaml
Read the render before installing. Both examples carry placeholder passwords; replace them, or leave auth.password empty and let the chart generate one.
Passwords
With auth.enabled: true and no auth.password and no auth.existingSecret, the chart generates a 32 character password on the first install and reuses it on every upgrade: it reads the Secret it created last time rather than rotating a credential the running pods still authenticate with. Set auth.password to choose your own, or set auth.existingSecret to a Secret you manage and the chart renders no Secret at all.
How it works
The master runs as its own StatefulSet, the replicas as another, and Sentinel as a third. Four behaviours are worth knowing:
- Automatic failback. After a failover, the master pod starts as a replica, waits for replication to catch up, and then asks Sentinel to hand the master role back. A watchdog sidecar (
master.watchdog) repeats that check while the pod runs, so a demotion after boot is corrected too. - Role-aware readiness. The readiness probe checks the Redis role, not just a PING. A master pod that has been demoted fails readiness and leaves the master Service endpoints, so clients are never routed to a node that cannot accept writes. A replica must also have its replication link up.
- Persisted Sentinel state. With
sentinel.persistence.enabledeach Sentinel keeps its config file on a volume, so a restarted quorum still knows which node is master. Without it, a simultaneous restart of every Sentinel loses that knowledge. - Split-brain guard.
configuration.min-replicas-to-writeandmin-replicas-max-lagmake the master refuse writes once no replica is acknowledging, so a partitioned master cannot accept writes that the failover would discard. The high availability example sets both.
Examples
| File | What it installs |
|---|---|
examples/minimal.yaml | One standalone Redis, persistence on, no Sentinel, no metrics |
examples/ha-sentinel.yaml | One master, two replicas, three Sentinels, watchdog, metrics exporter, split-brain guard |
Not implemented
These are deliberately absent rather than half-wired, so the values reference below lists nothing that does nothing:
| Not implemented | Detail |
|---|---|
| TLS | Redis is not configured to serve or verify TLS. Terminate elsewhere, or open an issue |
| Redis Cluster mode | architecture accepts standalone and replication only. Any other value fails the render instead of installing a release with no Redis in it |
| Scheduled backups | Persistence and RDB or AOF settings are exposed; nothing copies snapshots off the cluster |
If you need one of these, open an issue and say how you would use it. That is more useful than a values key that renders nothing.
Values
| Key | Type | Default | Description |
|---|---|---|---|
| architecture | string | "standalone" | Deployment architecture: standalone (single instance) or replication (master plus replicas, with optional Sentinel). Any other value fails the render. |
| auth.enabled | bool | true | Require a password on every Redis and Sentinel connection |
| auth.existingSecret | string | "" | Name of a Secret you manage yourself that already holds the passwords. When set, the chart renders no Secret of its own. |
| auth.existingSecretPasswordKey | string | "redis-password" | Key inside auth.existingSecret that holds the Redis password |
| auth.existingSecretSentinelPasswordKey | string | "redis-sentinel-password" | Key inside auth.existingSecret that holds the Sentinel password |
| auth.password | string | "" | Redis password. Leave empty and the chart generates one on first install and reuses it on every upgrade, so nothing well known ships as a default. Ignored when auth.existingSecret is set. |
| auth.sentinel | bool | true | Require a password on Sentinel connections as well (Sentinel only) |
| auth.sentinelPassword | string | "" | Sentinel password. Same generation rule as auth.password. |
| configuration.active-defrag-cycle-max | int | 25 | Maximum CPU percentage spent on defragmentation |
| configuration.active-defrag-cycle-min | int | 1 | Minimum CPU percentage spent on defragmentation |
| configuration.active-defrag-ignore-bytes | string | "100mb" | Fragmentation bytes below which defragmentation stays off |
| configuration.active-defrag-max-scan-fields | int | 1000 | Fields scanned per defragmentation cycle |
| configuration.active-defrag-threshold-lower | int | 10 | Fragmentation percentage that starts defragmentation |
| configuration.active-defrag-threshold-upper | int | 100 | Fragmentation percentage at which defragmentation runs at full effort |
| configuration.activedefrag | string | "no" | Enable active defragmentation |
| configuration.aof-load-truncated | string | "yes" | Load a truncated append only file instead of refusing to start |
| configuration.aof-use-rdb-preamble | string | "yes" | Write an RDB preamble at the head of the append only file |
| configuration.appendfilename | string | "appendonly.aof" | Name of the append only file |
| configuration.appendfsync | string | "everysec" | How often the append only file is flushed to disk |
| configuration.appendonly | string | "no" | Enable the append only file |
| configuration.auto-aof-rewrite-min-size | string | "64mb" | Minimum append only file size before a rewrite is considered |
| configuration.auto-aof-rewrite-percentage | int | 100 | Growth percentage that triggers an append only file rewrite |
| configuration.custom | string | "" | Full redis.conf content. When set, every key below is ignored. |
| configuration.daemonize | string | "no" | Run Redis in the background, always no inside a container |
| configuration.databases | int | 16 | Number of logical databases |
| configuration.dbfilename | string | "dump.rdb" | Name of the RDB file |
| configuration.dir | string | "/data" | Working directory, also where the RDB and AOF files live |
| configuration.enabled | bool | true | Render the generated redis.conf. With false the file is left empty. |
| configuration.hash-max-ziplist-entries | int | 512 | Hash entries kept in the compact encoding |
| configuration.hash-max-ziplist-value | int | 64 | Hash value size kept in the compact encoding |
| configuration.hll-sparse-max-bytes | int | 3000 | Bytes below which a HyperLogLog uses the sparse encoding |
| configuration.latency-monitor-threshold | int | 0 | Milliseconds above which an event is recorded by the latency monitor, 0 disables |
| configuration.lazyfree-lazy-eviction | string | "no" | Free evicted values in a background thread |
| configuration.lazyfree-lazy-expire | string | "no" | Free expired values in a background thread |
| configuration.lazyfree-lazy-server-del | string | "no" | Free values replaced by a write in a background thread |
| configuration.list-compress-depth | int | 0 | List nodes left uncompressed at each end |
| configuration.list-max-ziplist-size | int | -2 | List node sizing for the compact encoding |
| configuration.loglevel | string | "notice" | Log level |
| configuration.lua-time-limit | int | 5000 | Milliseconds a Lua script may run before it can be killed |
| configuration.maxmemory | string | "" | Memory ceiling, for example 384mb. Empty means no limit. |
| configuration.maxmemory-policy | string | "noeviction" | Eviction policy once maxmemory is reached |
| configuration.maxmemory-samples | int | 5 | Keys sampled per eviction decision |
| configuration.min-replicas-max-lag | string | "" | Seconds of replica lag tolerated by min-replicas-to-write |
| configuration.min-replicas-to-write | string | "" | Replicas that must be connected before the master accepts writes |
| configuration.no-appendfsync-on-rewrite | string | "no" | Skip fsync while a rewrite is running |
| configuration.notify-keyspace-events | string | "" | Keyspace notification classes, empty disables notifications |
| configuration.pidfile | string | "/var/run/redis.pid" | Path of the pid file |
| configuration.protected-mode | string | "no" | Accept connections from outside localhost |
| configuration.rdbchecksum | string | "yes" | Checksum RDB files |
| configuration.rdbcompression | string | "yes" | Compress RDB files |
| configuration.repl-disable-tcp-nodelay | string | "no" | Disable TCP_NODELAY on the replication link |
| configuration.repl-diskless-sync | string | "no" | Send the replication stream straight to the socket instead of a disk file |
| configuration.repl-diskless-sync-delay | int | 5 | Seconds to wait for more replicas before a diskless sync starts |
| configuration.replica-lazy-flush | string | "no" | Flush a replica dataset in a background thread on full resync |
| configuration.replica-priority | int | 100 | Promotion preference, lower wins. The chart manages this per pod. |
| configuration.replica-read-only | string | "yes" | Refuse writes sent directly to a replica |
| configuration.replica-serve-stale-data | string | "yes" | Serve reads from a replica whose link to the master is down |
| configuration.save | string | "900 1 300 10 60 10000" | RDB snapshot rules, empty disables snapshots |
| configuration.set-max-intset-entries | int | 512 | Integer set entries kept in the compact encoding |
| configuration.slowlog-log-slower-than | int | 10000 | Microseconds above which a command is logged as slow |
| configuration.slowlog-max-len | int | 128 | Entries kept in the slow log |
| configuration.stop-writes-on-bgsave-error | string | "yes" | Refuse writes when the last background save failed |
| configuration.stream-node-max-bytes | int | 4096 | Bytes per stream radix tree node |
| configuration.stream-node-max-entries | int | 100 | Entries per stream radix tree node |
| configuration.tcp-backlog | int | 511 | Pending connection backlog |
| configuration.tcp-keepalive | int | 300 | TCP keepalive interval in seconds |
| configuration.timeout | int | 0 | Seconds before an idle client is closed, 0 disables |
| configuration.zset-max-ziplist-entries | int | 128 | Sorted set entries kept in the compact encoding |
| configuration.zset-max-ziplist-value | int | 64 | Sorted set value size kept in the compact encoding |
| existingConfigmap | string | "" | Name of a ConfigMap holding your own redis.conf. When set, the chart renders no configuration ConfigMap of its own. |
| externalSecrets.enabled | bool | false | Render an ExternalSecret that delivers the Redis and Sentinel passwords |
| externalSecrets.redisPasswordSecret.key | string | "" | Remote key holding the Redis password |
| externalSecrets.redisPasswordSecret.property | string | "" | Property inside the remote key, when the remote value is structured |
| externalSecrets.refreshInterval | string | "6h" | How often the operator re-reads the remote values |
| externalSecrets.secretStore.kind | string | "ClusterSecretStore" | Kind of the store: ClusterSecretStore or SecretStore |
| externalSecrets.secretStore.name | string | "cluster-secret-store" | Name of the SecretStore or ClusterSecretStore to read from |
| externalSecrets.sentinelPasswordSecret.key | string | "" | Remote key holding the Sentinel password |
| externalSecrets.sentinelPasswordSecret.property | string | "" | Property inside the remote key, when the remote value is structured |
| fullnameOverride | string | "" | Override the fully qualified release name used in resource names |
| global.imagePullSecrets | list | [] | Image pull secret names added to every pod |
| global.imageRegistry | string | "" | Image registry applied to every image in the chart (empty uses each image's own registry) |
| global.redis.password | strin |
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.1.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