Self-hosted Valkey#

This page sets up Valkey in your own Kubernetes cluster with the Bitnami Valkey Helm charts, for Live Edit’s backing store. Read Backing store first for the requirements and sizing model. Self-hosting gives you full control of version, network and persistence, and makes you responsible for memory sizing, eviction policy, durability, failover and monitoring. The charts’ defaults do not meet Live Edit’s requirements, so set every value on this page.

Choose a topology#

Chart and mode

Failover

Use for

bitnami/valkey, architecture: standalone

none

development and evaluation

bitnami/valkey, architecture: replication

manual only

a data copy without automatic failover

bitnami/valkey-cluster

automatic

production

Choose standalone when losing the store for a while is acceptable: losing its volume or node means downtime and the loss of writes since the last checkpoint. Choose valkey-cluster for production: it promotes a replica when a primary fails and lets you add shards for memory and write capacity. Read replicas in replication mode do not offload Live Edit; all its traffic goes to the primary.

Warning

Sentinel mode (sentinel.enabled: true) is not supported. It removes the <release>-primary Service Live Edit connects to, and the Service it creates instead can route writes to a read-only replica.

Mirror the images#

Bitnami’s free catalog no longer publishes versioned images, so the chart’s default image may not pull. Copy the chart and the image you validate into a registry you control, pin both, and point the chart at your copy:

global:
  security:
    allowInsecureImages: true   # required when the image is not from Bitnami's registry
image:
  registry: registry.example.com
  repository: mirror/valkey
  tag: "{PINNED_TAG}"
  pullSecrets:
    - name: registry-pull-secret

Required configuration#

The bitnami/valkey chart sets neither a memory limit nor an eviction policy. Set these in commonConfiguration:

commonConfiguration: |-
  appendonly yes
  appendfsync everysec
  save ""
  maxmemory 3072mb
  maxmemory-policy noeviction
  maxclients 12000
  • maxmemory-policy noeviction is required.

  • maxmemory must sit below the pod’s memory limit, leaving about 20 % for persistence and replication buffers. Without it, the kernel’s out-of-memory killer, not Valkey, decides what happens when memory runs out.

  • maxclients 12000 covers a rollout at the chart’s defaults, on a single primary or a cluster; on a cluster Valkey’s default of 10,000 does not. If you change a connection pool or autoscaling.maxReplicas, check it as Connections shows.

  • appendonly yes with appendfsync everysec limits crash loss to about one second; save "" turns off RDB snapshots, which AOF replaces.

Authentication#

Deliver the password from its own Secret, never inline in values, and create it before installing Valkey:

kubectl create secret generic live-edit-valkey \
  --from-literal=valkey-password="${VALKEY_PASSWORD}" --namespace storage-apis

Keep it separate from Live Edit’s live-edit-env Secret, which the Live Edit uninstall steps delete. When you rotate the password, update both Secrets.

auth:
  enabled: true
  existingSecret: live-edit-valkey
  existingSecretPasswordKey: valkey-password

TLS#

tls:
  enabled: true
  authClients: false          # Live Edit presents no client certificate
  existingSecret: live-edit-valkey-tls
  certFilename: tls.crt
  certKeyFilename: tls.key
  certCAFilename: ca.crt

live-edit-valkey-tls holds the server certificate, key and CA, usually issued by cert-manager. Set authClients: false: with the chart default, true, Valkey demands a client certificate and rejects every Live Edit connection.

Live Edit verifies the server certificate against the public root certificates in its container image, not against the chart’s ca.crt. If a private CA (including a cert-manager issuer) signs the certificate, startup fails with an unknown-issuer error until you add that CA. Build one PEM bundle of the public roots plus your CA, store it in a ConfigMap, and mount it over the image’s bundle in your Live Edit values:

volumes:
  - name: ca-bundle
    configMap:
      name: live-edit-ca-bundle    # key ca-certificates.crt: public roots + your CA
volumeMounts:
  - name: ca-bundle
    mountPath: /etc/ssl/certs/ca-certificates.crt
    subPath: ca-certificates.crt
    readOnly: true

Keep the public roots in the bundle: it replaces the image’s bundle, and Live Edit also needs them for its other TLS connections, such as authentication services and telemetry collectors.

Persistence#

Size the volume at least twice maxmemory, since AOF rewrites briefly need double space, and use a StorageClass with allowVolumeExpansion: true:

primary:
  persistence:
    enabled: true
    size: 8Gi
    storageClass: {EXPANDABLE_STORAGE_CLASS}

Starting values#

Development (bitnami/valkey, standalone):

architecture: standalone
auth:
  enabled: true
  existingSecret: live-edit-valkey
  existingSecretPasswordKey: valkey-password
commonConfiguration: |-
  appendonly yes
  appendfsync everysec
  save ""
  maxmemory 1500mb
  maxmemory-policy noeviction
  maxclients 12000
tls:
  enabled: true
  authClients: false
  existingSecret: live-edit-valkey-tls
  certFilename: tls.crt
  certKeyFilename: tls.key
  certCAFilename: ca.crt
primary:
  resources:                 # replace the nano preset: scripts need a full core
    requests: { cpu: "1",  memory: 2Gi }
    limits:   { cpu: "1",  memory: 2Gi }
  persistence:
    enabled: true
    size: 8Gi

Production (bitnami/valkey-cluster, 3 primaries with one replica each):

cluster:
  nodes: 6
  replicas: 1
existingSecret: live-edit-valkey
existingSecretPasswordKey: valkey-password
tls:
  enabled: true
  authClients: false
  existingSecret: live-edit-valkey-tls
  certFilename: tls.crt
  certKeyFilename: tls.key
  certCAFilename: ca.crt
valkey:
  useAOFPersistence: "yes"
  configmap: |-
    maxmemory 3072mb
    maxmemory-policy noeviction
    maxclients 12000
  resources:
    requests: { cpu: "2", memory: 4Gi }
    limits:   { cpu: "2", memory: 6Gi }
persistence:
  size: 8Gi
  storageClass: {EXPANDABLE_STORAGE_CLASS}
metrics:
  enabled: true              # exporter for the memory and CPU signals

maxmemory is per node. Give each primary at least one dedicated core, two for production; never use the nano preset. Add the image settings above, then install the chart that matches the file. Name a cluster release with valkey-cluster in it so its Service keeps that name:

# development
helm install live-edit-valkey oci://registry-1.docker.io/bitnamicharts/valkey \
  --namespace storage-apis -f valkey-values.yaml
# production
helm install live-edit-valkey-cluster oci://registry-1.docker.io/bitnamicharts/valkey-cluster \
  --namespace storage-apis -f valkey-values.yaml

Connect Live Edit#

Put the URL, with the URL-encoded password, in the live-edit-env Secret’s valkey-url key, as Deployment shows:

Topology

URL

standalone or replication

rediss://:{PASSWORD}@{RELEASE}-primary:6379/0

valkey-cluster

rediss-cluster://:{PASSWORD}@{RELEASE}:6379

Leave valkey.credentials at its defaults (password in the URL).

Verify#

From valkey-cli connected to each primary, run:

CONFIG GET maxmemory-policy   # noeviction
CONFIG GET maxclients         # 12000; Valkey lowers it if the open-file limit is too low
INFO persistence              # aof_enabled:1

After installing Live Edit, check that its pods are ready and that live_edit_store_memory_used_ratio reports a value within a minute. Leave valkey.memoryBytes unset: Valkey reports its maxmemory to Live Edit.

Durability#

Live Edit checks AOF at startup on self-hosted Valkey: with AOF and checkpoints both off, it refuses to start. A failover loses writes the replica had not yet received, so pair AOF with checkpoints in production.

When to grow#

Signal

Threshold

Action

live_edit_store_memory_used_ratio

as Store memory says

raise maxmemory and the memory limit together; past one node’s practical memory, move to a cluster

Primary CPU (optional, if you run the Valkey exporter)

above 0.8 core sustained

raise CPU to 2–4 cores; past one saturated core, add shards

Persistence volume used ÷ capacity (optional, if you run the Valkey exporter)

above 0.75

grow the volume

connected_clients ÷ maxclients (optional, if you run the Valkey exporter)

above 0.70 outside rollouts

raise maxclients or add shards

live_edit_store_write_refused_total{reason="out_of_memory"}

any increase

the store is full: raise maxmemory and the memory limit now, even if the refusals stop by themselves

Raising memory or CPU restarts the Valkey pods: a short failover on a cluster, a write outage on a single primary.

Moving to a cluster#

Moving from bitnami/valkey to bitnami/valkey-cluster is a migration to a new chart with a data move, not an in-place upgrade; plan a maintenance window. Live Edit needs no change other than the new rediss-cluster:// URL. Live Edit verifies every node’s certificate against the hostname in the URL. If your nodes advertise IP addresses and each has its own certificate, include that hostname in every certificate’s subject alternative names. The startup log line Valkey transport configured shows tls_host_mapping=default-host when this hostname check is in effect.

Adding shards#

Adding or removing shards moves hash slots between primaries. A key-by-key move refuses writes to the layers and sessions in each moving slot until that slot’s move ends (When the store moves data between shards). This chart’s own way of adding nodes, cluster.update.addNodes: true on helm upgrade, rebalances with a key-by-key move, so run it off-peak.

To keep writes flowing, move slots with atomic slot migration, which needs Valkey 9.0 or later on every node:

  • With valkey-cli 9.1 or later, reshard with valkey-cli --cluster reshard {NODE}:6379 --cluster-use-atomic-slot-migration, adding the TLS and password options you use with valkey-cli.

  • With an older valkey-cli, send the move to the slots’ current owner, naming the target by its ID from CLUSTER NODES, then poll until it completes:

    valkey-cli -h {SOURCE_NODE} -p 6379 CLUSTER MIGRATESLOTS SLOTSRANGE {FIRST_SLOT} {LAST_SLOT} NODE {TARGET_NODE_ID}
    valkey-cli -h {SOURCE_NODE} -p 6379 CLUSTER GETSLOTMIGRATIONS
    

On Valkey before 9.0, reshard off-peak, a few slots at a time.

Warning

Let every slot’s move finish. Never assign a slot to another node with CLUSTER SETSLOT … NODE while keys remain on its old owner: the store can delete those keys.

Verify: valkey-cli --cluster check {NODE}:6379, with your TLS and password options, reports All 16384 slots covered and no open slots.

References#

See next#

Durability: choose AOF, checkpoints or both.