Redis is an open source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
This module is for deploying a Redis master-replica cluster as a LRU cache with persistent storage and append-only durable strategy.
This module uses the Chainguard Redis container image which comes with ARM and x86-64 support and fewer CVEs than the DockerHub Redis images.
This module is available on GitHub Container Registry at ghcr.io/stefanprodan/modules/redis.
To create an instance using the default values:
timoni -n default apply redis oci://ghcr.io/stefanprodan/modules/redis
The Redis cluster can be accessed using the following Kubernetes Services:
tcp://redis:6379
read-write endpoint for the Redis mastertcp://redis-readonly:6379
read-only endpoint with load balancing across Redis replicas
To install a specific module version:
timoni -n default apply redis oci://ghcr.io/stefanprodan/modules/redis -v 7.0.10
To change the default configuration,
create one or more values.cue
files and apply them to the instance.
For example, create a file my-values.cue
with the following content:
values: {
maxmemory: 1024
readonly: replicas: 2
persistence: {
enabled: true
storageClass: "standard"
size: "8Gi"
}
}
And apply the values with:
timoni -n default apply redis oci://ghcr.io/stefanprodan/modules/redis \
--values ./my-values.cue
To upgrade, run the apply command for a different version and/or different values.
timoni -n default apply redis oci://ghcr.io/stefanprodan/modules/redis \
--version latest \
--values ./my-values.cue \
--values ./my-other-values.cue
On config changes, Timoni will first upgrade the Redis master, will wait for it to become ready, then it will upgrade the read-only replicas.
To uninstall an instance and delete all its Kubernetes resources:
timoni -n default delete redis
Key | Type | Default | Description |
---|---|---|---|
maxmemory: |
int |
512 |
Redis max memory in Mi (this is also used to set resources.limits.memory ) |
readonly: replicas: |
int |
1 |
Number of Redis read-only replicas |
persistence: enabled: |
bool |
true |
Enable persistent storage for the Redis master node |
persistence: storageClass: |
string |
standard |
The PersistentVolumeClaim storage class name |
persistence: size: |
string |
8Gi |
The persistent volume size |
password: |
string |
"" |
When set, it enables auth for both the master and replicas with the specified password |
Key | Type | Default | Description |
---|---|---|---|
image: tag: |
string |
<latest version> |
Container image tag |
image: digest: |
string |
"" |
Container image digest, takes precedence over tag when specified |
image: repository: |
string |
cgr.dev/chainguard/redis |
Container image repository |
image: pullPolicy: |
string |
IfNotPresent |
Kubernetes image pull policy |
metadata: labels: |
{[ string]: string} |
{} |
Common labels for all resources |
metadata: annotations: |
{[ string]: string} |
{} |
Common annotations for all resources |
podAnnotations: |
{[ string]: string} |
{} |
Annotations applied to pods |
imagePullSecrets: |
[...corev1.LocalObjectReference] |
[] |
Kubernetes image pull secrets |
tolerations: |
[ ...corev1.#Toleration] |
[] |
Kubernetes toleration |
affinity: |
corev1.#Affinity |
{} |
Kubernetes affinity and anti-affinity |
resources: |
corev1.#ResourceRequirements |
{} |
Kubernetes resource requests and limits |
topologySpreadConstraints: |
[...corev1.#TopologySpreadConstraint] |
[] |
Kubernetes pod topology spread constraints |
podSecurityContext: |
corev1.#PodSecurityContext |
{runAsUser: 1001} |
Kubernetes pod security context |
securityContext: |
corev1.#SecurityContext |
{runAsNonRoot: true} |
Kubernetes container security context |