redis

by daviunx

Helm chartv1.1.0App 7.4.2MITVerified publisher

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

RequirementDetail
Kubernetes1.25 or newer, with a default StorageClass that supports dynamic provisioning when persistence is enabled
External Secrets OperatorOptional. 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 OperatorOptional, and only for metrics.serviceMonitor.enabled. The exporter sidecar itself needs nothing
Container imageredis: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.enabled each 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-write and min-replicas-max-lag make 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

FileWhat it installs
examples/minimal.yamlOne standalone Redis, persistence on, no Sentinel, no metrics
examples/ha-sentinel.yamlOne 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 implementedDetail
TLSRedis is not configured to serve or verify TLS. Terminate elsewhere, or open an issue
Redis Cluster modearchitecture accepts standalone and replication only. Any other value fails the render instead of installing a release with no Redis in it
Scheduled backupsPersistence 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

KeyTypeDefaultDescription
architecturestring"standalone"Deployment architecture: standalone (single instance) or replication (master plus replicas, with optional Sentinel). Any other value fails the render.
auth.enabledbooltrueRequire a password on every Redis and Sentinel connection
auth.existingSecretstring""Name of a Secret you manage yourself that already holds the passwords. When set, the chart renders no Secret of its own.
auth.existingSecretPasswordKeystring"redis-password"Key inside auth.existingSecret that holds the Redis password
auth.existingSecretSentinelPasswordKeystring"redis-sentinel-password"Key inside auth.existingSecret that holds the Sentinel password
auth.passwordstring""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.sentinelbooltrueRequire a password on Sentinel connections as well (Sentinel only)
auth.sentinelPasswordstring""Sentinel password. Same generation rule as auth.password.
configuration.active-defrag-cycle-maxint25Maximum CPU percentage spent on defragmentation
configuration.active-defrag-cycle-minint1Minimum CPU percentage spent on defragmentation
configuration.active-defrag-ignore-bytesstring"100mb"Fragmentation bytes below which defragmentation stays off
configuration.active-defrag-max-scan-fieldsint1000Fields scanned per defragmentation cycle
configuration.active-defrag-threshold-lowerint10Fragmentation percentage that starts defragmentation
configuration.active-defrag-threshold-upperint100Fragmentation percentage at which defragmentation runs at full effort
configuration.activedefragstring"no"Enable active defragmentation
configuration.aof-load-truncatedstring"yes"Load a truncated append only file instead of refusing to start
configuration.aof-use-rdb-preamblestring"yes"Write an RDB preamble at the head of the append only file
configuration.appendfilenamestring"appendonly.aof"Name of the append only file
configuration.appendfsyncstring"everysec"How often the append only file is flushed to disk
configuration.appendonlystring"no"Enable the append only file
configuration.auto-aof-rewrite-min-sizestring"64mb"Minimum append only file size before a rewrite is considered
configuration.auto-aof-rewrite-percentageint100Growth percentage that triggers an append only file rewrite
configuration.customstring""Full redis.conf content. When set, every key below is ignored.
configuration.daemonizestring"no"Run Redis in the background, always no inside a container
configuration.databasesint16Number of logical databases
configuration.dbfilenamestring"dump.rdb"Name of the RDB file
configuration.dirstring"/data"Working directory, also where the RDB and AOF files live
configuration.enabledbooltrueRender the generated redis.conf. With false the file is left empty.
configuration.hash-max-ziplist-entriesint512Hash entries kept in the compact encoding
configuration.hash-max-ziplist-valueint64Hash value size kept in the compact encoding
configuration.hll-sparse-max-bytesint3000Bytes below which a HyperLogLog uses the sparse encoding
configuration.latency-monitor-thresholdint0Milliseconds above which an event is recorded by the latency monitor, 0 disables
configuration.lazyfree-lazy-evictionstring"no"Free evicted values in a background thread
configuration.lazyfree-lazy-expirestring"no"Free expired values in a background thread
configuration.lazyfree-lazy-server-delstring"no"Free values replaced by a write in a background thread
configuration.list-compress-depthint0List nodes left uncompressed at each end
configuration.list-max-ziplist-sizeint-2List node sizing for the compact encoding
configuration.loglevelstring"notice"Log level
configuration.lua-time-limitint5000Milliseconds a Lua script may run before it can be killed
configuration.maxmemorystring""Memory ceiling, for example 384mb. Empty means no limit.
configuration.maxmemory-policystring"noeviction"Eviction policy once maxmemory is reached
configuration.maxmemory-samplesint5Keys sampled per eviction decision
configuration.min-replicas-max-lagstring""Seconds of replica lag tolerated by min-replicas-to-write
configuration.min-replicas-to-writestring""Replicas that must be connected before the master accepts writes
configuration.no-appendfsync-on-rewritestring"no"Skip fsync while a rewrite is running
configuration.notify-keyspace-eventsstring""Keyspace notification classes, empty disables notifications
configuration.pidfilestring"/var/run/redis.pid"Path of the pid file
configuration.protected-modestring"no"Accept connections from outside localhost
configuration.rdbchecksumstring"yes"Checksum RDB files
configuration.rdbcompressionstring"yes"Compress RDB files
configuration.repl-disable-tcp-nodelaystring"no"Disable TCP_NODELAY on the replication link
configuration.repl-diskless-syncstring"no"Send the replication stream straight to the socket instead of a disk file
configuration.repl-diskless-sync-delayint5Seconds to wait for more replicas before a diskless sync starts
configuration.replica-lazy-flushstring"no"Flush a replica dataset in a background thread on full resync
configuration.replica-priorityint100Promotion preference, lower wins. The chart manages this per pod.
configuration.replica-read-onlystring"yes"Refuse writes sent directly to a replica
configuration.replica-serve-stale-datastring"yes"Serve reads from a replica whose link to the master is down
configuration.savestring"900 1 300 10 60 10000"RDB snapshot rules, empty disables snapshots
configuration.set-max-intset-entriesint512Integer set entries kept in the compact encoding
configuration.slowlog-log-slower-thanint10000Microseconds above which a command is logged as slow
configuration.slowlog-max-lenint128Entries kept in the slow log
configuration.stop-writes-on-bgsave-errorstring"yes"Refuse writes when the last background save failed
configuration.stream-node-max-bytesint4096Bytes per stream radix tree node
configuration.stream-node-max-entriesint100Entries per stream radix tree node
configuration.tcp-backlogint511Pending connection backlog
configuration.tcp-keepaliveint300TCP keepalive interval in seconds
configuration.timeoutint0Seconds before an idle client is closed, 0 disables
configuration.zset-max-ziplist-entriesint128Sorted set entries kept in the compact encoding
configuration.zset-max-ziplist-valueint64Sorted set value size kept in the compact encoding
existingConfigmapstring""Name of a ConfigMap holding your own redis.conf. When set, the chart renders no configuration ConfigMap of its own.
externalSecrets.enabledboolfalseRender an ExternalSecret that delivers the Redis and Sentinel passwords
externalSecrets.redisPasswordSecret.keystring""Remote key holding the Redis password
externalSecrets.redisPasswordSecret.propertystring""Property inside the remote key, when the remote value is structured
externalSecrets.refreshIntervalstring"6h"How often the operator re-reads the remote values
externalSecrets.secretStore.kindstring"ClusterSecretStore"Kind of the store: ClusterSecretStore or SecretStore
externalSecrets.secretStore.namestring"cluster-secret-store"Name of the SecretStore or ClusterSecretStore to read from
externalSecrets.sentinelPasswordSecret.keystring""Remote key holding the Sentinel password
externalSecrets.sentinelPasswordSecret.propertystring""Property inside the remote key, when the remote value is structured
fullnameOverridestring""Override the fully qualified release name used in resource names
global.imagePullSecretslist[]Image pull secret names added to every pod
global.imageRegistrystring""Image registry applied to every image in the chart (empty uses each image's own registry)
global.redis.passwordstrin

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.1.0 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