redis-ha

by joaquinito2051

Helm chartv3.4.2App 5.0.3

Highly available Kubernetes implementation of Redis

About this chart

Redis

Redis is an advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

TL;DR;

$ helm install <helm-repo>/redis-ha

$ helm install stable/redis-ha By default this chart install 3 pods total:

  • one pod containing a redis master and sentinel container (optional prometheus metrics exporter sidecar available)
  • two pods each containing a redis slave and sentinel containers (optional prometheus metrics exporter sidecars available)

Introduction

This chart bootstraps a Redis highly available master/slave statefulset in a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure

Upgrading the Chart

Please note that there have been a number of changes simplifying the redis management strategy (for better failover and elections) in the 3.x version of this chart. These changes allow the use of official redis images that do not require special RBAC or ServiceAccount roles. As a result when upgrading from version >=2.0.1 to >=3.0.0 of this chart, Role, RoleBinding, and ServiceAccount resources should be deleted manually.

Installing the Chart

To install the chart

$ helm install <helm-repo>/redis-ha

$ helm install stable/redis-ha The command deploys Redis on the Kubernetes cluster in the default configuration. By default this chart install one master pod containing redis master container and sentinel container along with 2 redis slave pods each containing their own sentinel sidecars. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the deployment:

$ helm delete <chart-name>

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Redis chart and their default values.

ParameterDescriptionDefault
imageRedis imageredis
tagRedis tag5.0.3-alpine
replicasNumber of redis master/slave pods3
serviceAccount.createSpecifies whether a ServiceAccount should be createdtrue
serviceAccount.nameThe name of the ServiceAccount to createGenerated using the redis-ha.fullname template
rbac.createCreate and use RBAC resourcestrue
redis.portPort to access the redis service6379
redis.masterGroupNameRedis convention for naming the cluster groupmymaster
redis.configAny valid redis config options in this section will be applied to each server (see below)see values.yaml
redis.customConfigAllows for custom redis.conf files to be applied. If this is used then redis.config is ignored``
redis.resourcesCPU/Memory for master/slave nodes resource requests/limits{}
sentinel.portPort to access the sentinel service26379
sentinel.quorumMinimum number of servers necessary to maintain quorum2
sentinel.configValid sentinel config options in this section will be applied as config options to each sentinel (see below)see values.yaml
sentinel.customConfigAllows for custom sentinel.conf files to be applied. If this is used then sentinel.config is ignored``
sentinel.resourcesCPU/Memory for sentinel node resource requests/limits{}
init.resourcesCPU/Memory for init Container node resource requests/limits{}
authEnables or disables redis AUTH (Requires redisPassword to be set)false
redisPasswordA password that configures a requirepass and masterauth in the conf parameters (Requires auth: enabled)``
authKeyThe key holding the redis password in an existing secret.auth
existingSecretAn existing secret containing a key defined by authKey that configures requirepass and masterauth in the conf parameters (Requires auth: enabled, cannot be used in conjunction with .Values.redisPassword)``
nodeSelectorNode labels for pod assignment{}
tolerationsToleration labels for pod assignment[]
podAntiAffinity.serverAntiaffinity for pod assignment of servers, hard or softHard node and soft zone anti-affinity
exporter.enabledIf true, the prometheus exporter sidecar is enabledfalse
exporter.imageExporter imageoliver006/redis_exporter
exporter.tagExporter tagv0.31.0
exporter.annotationsPrometheus scrape annotations{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}
exporter.extraArgsAdditional args for the exporter{}
podDisruptionBudgetPod Disruption Budget rules{}
hostPath.pathUse this path on the host for data storagenot set
hostPath.chownRun an init-container as root to set ownership on the hostPathtrue
sysctlImage.enabledEnable an init container to modify Kernel settingsfalse
sysctlImage.commandsysctlImage command to execute[]
sysctlImage.registrysysctlImage Init container registrydocker.io
`sysctlImage.repositor

Deploy redis-ha with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has redis-ha 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-ha is pinned at v3.4.2 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