redis-ha
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.
| Parameter | Description | Default |
|---|---|---|
image | Redis image | redis |
tag | Redis tag | 5.0.3-alpine |
replicas | Number of redis master/slave pods | 3 |
serviceAccount.create | Specifies whether a ServiceAccount should be created | true |
serviceAccount.name | The name of the ServiceAccount to create | Generated using the redis-ha.fullname template |
rbac.create | Create and use RBAC resources | true |
redis.port | Port to access the redis service | 6379 |
redis.masterGroupName | Redis convention for naming the cluster group | mymaster |
redis.config | Any valid redis config options in this section will be applied to each server (see below) | see values.yaml |
redis.customConfig | Allows for custom redis.conf files to be applied. If this is used then redis.config is ignored | `` |
redis.resources | CPU/Memory for master/slave nodes resource requests/limits | {} |
sentinel.port | Port to access the sentinel service | 26379 |
sentinel.quorum | Minimum number of servers necessary to maintain quorum | 2 |
sentinel.config | Valid sentinel config options in this section will be applied as config options to each sentinel (see below) | see values.yaml |
sentinel.customConfig | Allows for custom sentinel.conf files to be applied. If this is used then sentinel.config is ignored | `` |
sentinel.resources | CPU/Memory for sentinel node resource requests/limits | {} |
init.resources | CPU/Memory for init Container node resource requests/limits | {} |
auth | Enables or disables redis AUTH (Requires redisPassword to be set) | false |
redisPassword | A password that configures a requirepass and masterauth in the conf parameters (Requires auth: enabled) | `` |
authKey | The key holding the redis password in an existing secret. | auth |
existingSecret | An 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) | `` |
nodeSelector | Node labels for pod assignment | {} |
tolerations | Toleration labels for pod assignment | [] |
podAntiAffinity.server | Antiaffinity for pod assignment of servers, hard or soft | Hard node and soft zone anti-affinity |
exporter.enabled | If true, the prometheus exporter sidecar is enabled | false |
exporter.image | Exporter image | oliver006/redis_exporter |
exporter.tag | Exporter tag | v0.31.0 |
exporter.annotations | Prometheus scrape annotations | {prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"} |
exporter.extraArgs | Additional args for the exporter | {} |
podDisruptionBudget | Pod Disruption Budget rules | {} |
hostPath.path | Use this path on the host for data storage | not set |
hostPath.chown | Run an init-container as root to set ownership on the hostPath | true |
sysctlImage.enabled | Enable an init container to modify Kernel settings | false |
sysctlImage.command | sysctlImage command to execute | [] |
sysctlImage.registry | sysctlImage Init container registry | docker.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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartredis-ha is pinned at v3.4.2 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