keydb

by finkinfridom

Helm chartv0.48.3App 6.3.4Verified publisher

A Helm chart for KeyDB multimaster setup

About this chart

KeyDB

KeyDB clocks in at 5X faster than Redis (node vs node). KeyDB is a popular drop in Redis alternative that people flock to because it enables you to consolidate a lot of the complexities associated with Redis. KeyDB is multithreaded with the ability to use several storage mediums natively and scale vertically. The superior architecture is enabling KeyDB to become the bridge between cache layer and traditional databases offering performance and durability.

TL;DR;

helm repo add finkinfridom https://raw.githubusercontent.com/finkinfridom/charts/main/charts/
helm install keydb finkinfridom/keydb

Introduction

This chart bootstraps a KeyDB highly available multi-master statefulset in a Kubernetes cluster using the Helm package manager.

0.48.2

Updated appVersion to 6.3.4

0.40.1 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases.

exporter.pullPolicy is deprecated in favor of exporter.imagePullPolicy

0.38.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases.

This release enables using a dedicated ServiceAccount for the KeyDB StatefulSet. Either an SA created by the chart or a pre-exising SA can be used. The corresponding value setting serviceAccount.enabled is turned off by default for backward compatibility.

Please note that the serviceAccountName field of the StatefulSet's spec is immutable, so an upgrade from a helm release where the dedicated SA is disabled (the default) to a release where it is explicitly enabled is impossible and will fail. You should plan a migration to an SA-enabled release in advance considering your environment and operational practices, e.g. using a blue-green deployment or scheduling a downtime for removal of the previous release. In case of removal please also consider data retention as necessary, e.g. verify the reclaim policy of the StorageClass in use.

If you plan a deployment in an environment where dedicated ServiceAccounts are essential, e.g. in a service mesh, please consider enabling the SA setting from the start.

0.33.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases. Since 0.33.0 scripts.cleanup is obsoleted by scripts.cleanupTempfiles. scripts.cleanupCoredumps section is added in order to provide ability to cleanup core.* files and is disabled by default. Please look values.yaml.

0.30.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases. Since 0.30.0 additionalAffinities option is completely obsolete and affinity replaces it. affinity is rendered dynamically (approach is taken from Bitnami charts) so you can set dynamic things like '{{ .Release.Name }}' right inside the affinity: key in values.yaml. Will extend this approach for other places in the future.

0.29.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases. Since 0.29.0 configExtraArgs and exporter.extraArgs are now arrays of dicts in order to allow repeating arguments with the same key. If dict value is an array it is interpreted as multiple arguments for the key.

Config Example:

configExtraArgs:
  - client-output-buffer-limit: ["normal", "0", "0", "0"]
  - client-output-buffer-limit: ["replica", "268435456", "67108864", "60"]
  - client-output-buffer-limit: ["pubsub", "33554432", "8388608", "60"]
  - save: ~
  - tcp-backlog "1024"

Resulting File:

...

exec keydb-server /etc/keydb/redis.conf \

    ...

    --client-output-buffer-limit "normal" "0" "0" "0" \
    --client-output-buffer-limit "replica" "268435456" "67108864" "60" \
    --client-output-buffer-limit "pubsub" "33554432" "8388608" "60" \
    --save \
    --tcp-backlog "1024" \

    ...

Prerequisites

  • PV provisioner support in the underlying infrastructure if you want to enable persistence

Installing the Chart

To install the chart

helm repo add enapter https://enapter.github.io/charts/
helm install keydb enapter/keydb

Configuration

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

ParameterDescriptionDefault
imageRepositoryKeyDB docker imageeqalpha/keydb
imageTagKeyDB docker image tagx86_64_v6.3.2
imagePullPolicyK8s imagePullPolicyIfNotPresent
imagePullSecretsKeyDB Pod imagePullSecrets[]
nodesNumber of KeyDB master pods3
passwordIf enabled KeyDB servers are password-protected""
existingSecretIf enabled password is taken from secret""
existingSecretPasswordKeySecret key name."password"
portKeyDB service port clients connect to6379
portNameKeyDB service port name in the Service specserver
threadsKeyDB server-threads per node2
multiMasterKeyDB multi-master setupyes
activeReplicasKeyDB active replication setupyes
protectedModeKeyDB protection modeno
appendonlyKeyDB appendonly settingno
configExtraArgsAdditional configuration arguments for KeyDB[]
annotationsKeyDB StatefulSet annotations{}
podAnnotationsKeyDB pods annotations{}
tolerationsKeyDB tolerations setting{}
nodeSelectorKeyDB nodeSelector setting{}
topologySpreadConstraintsKeyDB topologySpreadConstraints setting[]
affinityStatefulSet Affinity rulesLook values.yaml
extraInitContainersAdditional init containers for StatefulSet[]
extraContainersAdditional sidecar containers for StatefulSet[]
extraVolumesAdditional volumes for init and sidecar containers[]
livenessProbe.customCustom LivenessProbe for KeyDB pods{}
readinessProbe.customCustom ReadinessProbe for KeyDB pods{}
readinessProbeRandomUuidRandom UUIDv4 for readiness GET probe90f717dd-0e68-43b8-9363-fddaad00d6c9
startupProbe.customCustom StartupProbe for KeyDB pods{}
persistentVolume.enabledShould PVC be created via volumeClaimTemplatestrue
persistentVolume.accessModesVolume access modes[ReadWriteOnce]
persistentVolume.selectorPVC selector. (In order to match existing PVs){}
persistentVolume.sizeSize of the volume1Gi
persistentVolume.storageClassStorageClassName for volume``
podDisruptionBudgetpodDisruptionBudget for KeyDB podsLook values.yaml
resourcesResources for KeyDB containers{}
scripts.enabledTurn on health util scriptsfalse
scripts.cleanupCoredumpsCoredumps cleanup scriptsLook values.yaml
scripts.cleanupTempfilesTempfiles cleanup scriptsLook values.yaml
scripts.securityContextSecurityContext for scripts container{}
keydb.securityContextSecurityContext for KeyDB container{}
securityContextSecurityContext for KeyDB pods{}
service.annotationsService annotations{}
service.appProtocol.enabledTurn on appProtocol fields in port specsfalse
loadBalancer.enabledCreate LoadBalancer servicefalse
loadBalancer.annotationsAnnotations for LB{}
loadBalancer.extraSpecAdditional spec for LB{}
serviceAccount.enabledUse a dedicated ServiceAccount (SA)false
serviceAccount.createCreate the SA (rather than use an existing one)true
serviceAccount.nameSet the name of an existing SA or override created``
serviceAccount.extraSpecAdditional spec for the created SA{}
serviceMonitor.enabledPrometheus operator ServiceMonitorfalse
serviceMonitor.labelsAdditional labels for ServiceMonitor{}
serviceMonitor.annotationsAdditional annotations for ServiceMonitor{}
serviceMonitor.intervalServiceMonitor scrape interval30s
serviceMonitor.scrapeTimeoutServiceMonitor scrape timeoutnil
exporter.enabledPrometheus Exporter sidecar contanerfalse
exporter.imageRepositoryExporter Imageoliver006/redis_exporter
exporter.imageTagExporter Image Tagv1.48.0-alpine
exporter.pullPolicyExporter imagePullPolicyIfNotPresent
exporter.portprometheus.io/port9121
exporter.portNameExporter service port name in the Service specredis-exporter
exporter.scrapePathprometheus.io/path/metrics
exporter.livenessProbeLivenessProbe for sidecar Prometheus exporterLook values.yaml
exporter.readinessProbeReadinessProbe for sidecar Prometheus exporterLook values.yaml
exporter.startupProbeStartupProbe for sidecar Prometheus exporterLook values.yaml
exporter.resourcesResources for sidecar Prometheus container{}
exporter.securityContextSecurityContext for Prometheus exporter container{}
exporter.extraArgsAdditional arguments for exporter[]

Using existingSecret

When definining existingSecret (by default is "") password value is ignored. Password is taken from that secret, instead of being provided as plain text under values.yaml file.
Secret key must be existingSecretPasswordKey (password by default).
Example of of such secret:

Deploy keydb with OpenTenant

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