valkey
by Bitnami
Valkey is an open source (BSD) high-performance key/value datastore that supports a variety workloads such as caching, message queues, and can act as a primary database.
About this chart
Bitnami Secure Images Helm chart for Valkey
Valkey is an open source (BSD) high-performance key/value datastore that supports a variety workloads such as caching, message queues, and can act as a primary database.
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
TL;DR
helm install my-release oci://MY-OCI-REGISTRY/valkey
Why use Bitnami Secure Images?
Those are hardened, minimal CVE images built and maintained by Bitnami. Bitnami Secure Images are based on the cloud-optimized, security-hardened enterprise OS Photon Linux. Why choose BSI images?
- Hardened secure images of popular open source software with Near-Zero Vulnerabilities
- Vulnerability Triage & Prioritization with VEX Statements, KEV and EPSS Scores
- Compliance focus with FIPS, STIG, and air-gap options, including secure bill of materials (SBOM)
- Software supply chain provenance attestation through in-toto
- First class support for the internet’s favorite Helm charts
Each image comes with valuable security metadata. You can view the metadata in our public catalog here. Note: Some data is only available with commercial subscriptions to BSI.
If you are looking for our previous generation of images based on Debian Linux, please see the Bitnami Legacy registry.
Introduction
This chart bootstraps a Valkey deployment on a Kubernetes cluster using the Helm package manager.
Before you begin
- Kubernetes 1.23+
- Helm 3.8.0+
- PV provisioner support in the underlying infrastructure
Installing the Chart
First, log in to the OCI registry and create a secret with your registry credentials:
helm registry login REGISTRY_NAME
kubectl create secret docker-registry SECRET_NAME -n NAMESPACE \
--docker-server REGISTRY_NAME \
--docker-username "USER" \
--docker-password "TOKEN"
Note Replace the placeholders in these commands (
REGISTRY_NAME,SECRET_NAME,NAMESPACE,USER, andTOKEN) with your actual values.
Then install the chart with the release name my-release:
helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/valkey --set "global.imagePullSecrets[0]=SECRET_NAME" -n NAMESPACE
Note Replace the placeholders in the
helm installcommand (REGISTRY_NAME,REPOSITORY_NAME,SECRET_NAME, andNAMESPACE) with your actual values.
The command deploys Valkey on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.
Tip: List all releases using
helm list
Configuration and installation details
This section describes credentials, configuration, and other installation options.
Resource requests and limits
Bitnami charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources value (check parameter table). Setting requests is essential for production workloads, and these should be adapted to your specific use case.
To make this process easier, the chart contains the resourcesPreset values, which automatically sets the resources section according to different presets. Check these presets in the bitnami/common chart. However, in production workloads using resourcesPreset is discouraged as it may not fully adapt to your specific needs. Find more information on container resource management in the official Kubernetes documentation.
Update credentials
The Bitnami Valkey chart, when upgrading, reuses the secret previously rendered by the chart or the one specified in auth.existingSecret. To update credentials, use one of the following:
- Run
helm upgradespecifying a new password inauth.password - Run
helm upgradespecifying a new secret inauth.existingSecret
Prometheus metrics
This chart can be integrated with Prometheus by setting metrics.enabled to true. This will deploy a sidecar container with redis_exporter in all pods and a metrics service, which can be configured under the metrics.service section. This metrics service will have the necessary annotations to be automatically scraped by Prometheus.
Prometheus requirements
It is necessary to have a working installation of Prometheus or Prometheus Operator for the integration to work. Install the Bitnami Prometheus helm chart or the Bitnami Kube Prometheus helm chart to easily have a working Prometheus in your cluster.
Integration with Prometheus Operator
The chart can deploy ServiceMonitor objects for integration with Prometheus Operator installations. To do so, set the value metrics.serviceMonitor.enabled=true. Ensure that the Prometheus Operator CustomResourceDefinitions are installed in the cluster or it will fail with the following error:
no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
Install the Bitnami Kube Prometheus helm chart for having the necessary CRDs and the Prometheus Operator.
Rolling VS Immutable tags
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
Load custom modules in Valkey;
You can use the commonConfiguration parameter to specify the modules to load. For example, to load the Valkey-Search, Valkey-Bloom, Valkey-JSON and Valkey-LDAP modules supported from Valkey, you can set the following:
commonConfiguration: |
loadmodule /opt/bitnami/valkey/modules/libsearch.so
loadmodule /opt/bitnami/valkey/modules/libvalkey_bloom.so
loadmodule /opt/bitnami/valkey/modules/libvalkey_ldap.so
loadmodule /opt/bitnami/valkey/modules/libjson.so
Use a different Valkey version
To modify the application version used in this chart, specify a different version of the image using the image.tag parameter and/or a different repository using the image.repository parameter.
Bootstrapping with an External Cluster
This chart is equipped with the ability to bring online a set of Pods that connect to an existing Valkey deployment that lies outside of Kubernetes. This effectively creates a hybrid Valkey Deployment where both Pods in Kubernetes and Instances such as Virtual Machines can partake in a single Valkey Deployment. This is helpful in situations where one may be migrating Valkey from Virtual Machines into Kubernetes, for example. To take advantage of this, use the following as an example configuration:
replica:
externalPrimary:
enabled: true
host: external-valkey-0.internal
sentinel:
externalPrimary:
enabled: true
host: external-valkey-0.internal
:warning: This is currently limited to clusters in which Sentinel and Valkey run on the same node! :warning:
Please also note that the external sentinel must be listening on port 26379, and this is currently not configurable.
Once the Kubernetes Valkey Deployment is online and confirmed to be working with the existing cluster, the configuration can then be removed and the cluster will remain connected.
External DNS
This chart is equipped to allow leveraging the ExternalDNS project. Doing so will enable ExternalDNS to publish the FQDN for each instance, in the format of <pod-name>.<release-name>.<dns-suffix>.
Example, when using the following configuration:
useExternalDNS:
enabled: true
suffix: prod.example.org
additionalAnnotations:
ttl: 10
On a cluster where the name of the Helm release is a, the hostname of a Pod is generated as: a-valkey-node-0.a-valkey.prod.example.org. The IP of that FQDN will match that of the associated Pod. This modifies the following parameters of the Valkey/Sentinel configuration using this new FQDN:
replica-announce-ipknown-sentinelknown-replicaannounce-ip
:warning: This requires a working installation of external-dns to be fully functional. :warning:
See the official ExternalDNS documentation for additional configuration options.
Cluster topologies
Default: Primary-Replicas
When installing the chart with architecture=replication, it will deploy a Valkey primary StatefulSet and a Valkey replicas StatefulSet. The replicas will be read-replicas of the primary. Two services will be exposed:
- Valkey Primary service: Points to the primary, where read-write operations can be performed
- Valkey Replicas service: Points to the replicas, where only read operations are allowed by default.
In case the primary crashes, the replicas will wait until the primary node is respawned again by the Kubernetes Controller Manager.
Standalone
When installing the chart with architecture=standalone, it will deploy a standalone Valkey StatefulSet. A single service will be exposed:
- Valkey Primary service: Points to the primary, where read-write operations can be performed
Primary-Replicas with Sentinel
When installing the chart with architecture=replication and sentinel.enabled=true, it will deploy a single Valkey StatefulSet. In this case, the pods will contain an extra container with Valkey Sentinel. This container will form a cluster of Valkey Sentinel nodes, which will promote a new primary in case the actual one fails.
On graceful termination of the Valkey primary pod, failover of the primary is initiated to promote a new primary. The Valkey Sentinel container in this pod will wait for the failover to occur before terminating. If sentinel.valkeyShutdownWaitFailover=true is set (the default), the Valkey container will wait for the failover as well before terminating. This increases availability for reads during failover, but may cause stale reads until all clients have switched to the new primary.
In addition to this, only one service is exposed:
- Valkey service: Exposes port 6379 for Valkey read-only operations and port 26379 for accessing Valkey Sentinel.
For read-only operations, access the service using port 6379. For write operations, it's necessary to access the Valkey Sentinel cluster and query the current primary using the command below (using valkey-cli or similar):
SENTINEL get-primary-addr-by-name <name of your PrimarySet (e.g., myprimary)>
This command will return the address of the current primary, which can be accessed from inside the cluster.
In case the current primary crashes, the Sentinel containers will elect a new primary node.
primary.replicaCount greater than 1 is not designed for use when sentinel.enabled=true.
Multiple primary nodes (experimental)
When primary.replicaCount is greater than 1, special care must be taken to create a consistent setup.
An example of use case is the creation of a redundant set of standalone primary nodes or primary-replicas per Kubernetes node where you must ensure:
- No more than
1primary can be deployed per Kubernetes node - Replicas and writers can only see the single primary of their own Kubernetes node
One way of achieving this is by setting primary.service.internalTrafficPolicy=Local in combination with a primary.affinity.podAntiAffinity spec to never schedule more than one primary per Kubernetes node.
It's recommended to only change primary.replicaCount if you know what you are doing.
primary.replicaCount greater than 1 is not designed for use when sentinel.enabled=true.
Using a password file
To use a password file for Valkey, you need to create a secret containing the password and then deploy the chart using that secret. Follow these instructions:
- Create the secret with the password. It is important that the file with the password must be called
valkey-password.
kubectl create secret generic valkey-password-secret --from-file=valkey-password.yaml
- Deploy the Helm Chart using the secret name as parameter:
usePassword=true
usePasswordFile=true
existingSecret=valkey-password-secret
sentinels.enabled=true
metrics.enabled=true
Securing traffic using TLS
TLS support can be enabled in the chart by specifying the tls. parameters while creating a release. The following parameters should be configured to properly enable the TLS support in the cluster:
tls.enabled: Enable TLS support. Defaults tofalsetls.existingSecret: Name of the secret that contains the certificates. No defaults.tls.certFilename: Certificate filename. No defaults.tls.certKeyFilename: Certificate key filename. No defaults.tls.certCAFilename: CA Certificate filename. No defaults.
For example:
First, create the secret with the certificate f
Deploy valkey with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has valkey 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 chartvalkey is pinned at v6.3.19 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