Back to Hub

cargo.ayedo.cloud/ayedo/k8s/valkey 0.2.2 k8sapp BSD-3-Clause

Deploy Valkey (Redis-compatible in-memory data store) to Kubernetes

polycrate block pull cargo.ayedo.cloud/ayedo/k8s/valkey:0.2.2

Valkey Kubernetes Block

Deploy Valkey (Redis-compatible in-memory data store) to Kubernetes.

Overview

This block deploys Valkey as a single StatefulSet (valkey-master) with:

  • Standalone architecture (replication is not implemented)
  • Persistent storage via PVC, or an emptyDir for pure caches
  • Authentication without exposing the password in process arguments
  • Hardened pod: read-only root filesystem, non-root, seccompProfile: RuntimeDefault, all capabilities dropped, no service account token, DEBUG/MODULE commands disabled
  • Metrics via a redis_exporter sidecar and optional VMServiceScrape
  • Automatic rollout on config or password changes (checksum annotations)

Quick Start

# workspace.poly
blocks:
  - name: valkey
    from: cargo.ayedo.cloud/ayedo/k8s/valkey
    config:
      namespace: my-namespace
      auth:
        enabled: true   # password via secrets.poly
      master:
        persistence:
          enabled: true
          size: 8Gi

Actions

  • install — Deploy Valkey to Kubernetes
  • uninstall — Remove Valkey from Kubernetes
  • status — Show deployment status
  • info — Show configuration
polycrate run valkey install
polycrate run valkey status
polycrate run valkey uninstall

Configuration

Basic Settings

  • namespace — Default: valkey; Description: Kubernetes namespace
  • architecture — Default: standalone; Description: Only standalone is supported; install fails otherwise

Image Configuration

  • image_registry — Default: docker.io; Description: Container registry
  • image_name — Default: valkey/valkey; Description: Image name
  • image_tag — Default: ""; Description: Tag (defaults to app_version)

Authentication

  • auth.enabled — Default: true; Description: Enable password authentication
  • auth.password — Default: ""; Description: Password (set via secrets.poly; install fails if empty while auth is enabled)

The password is stored in the Secret valkey-auth (keys password and auth.conf). Valkey loads it through include /etc/valkey-auth/auth.conf; probes and the exporter read it from environment variables. Applications can reference the Secret key password directly (e.g. Nextcloud externalRedis.existingSecret).

Master Configuration

  • master.replicas — Default: 1; Description: Number of pods (keep at 1, no replication)
  • master.port — Default: 6379; Description: Valkey port
  • master.persistence.enabled — Default: true; Description: Enable PVC; false uses an emptyDir
  • master.persistence.size — Default: 8Gi; Description: PVC size
  • master.persistence.storage_class — Default: ""; Description: Storage class

Valkey Configuration

  • master.config.appendonly — Default: yes; Description: Enable AOF persistence
  • master.config.save — Default: ""; Description: RDB save configuration
  • master.config.maxmemory — Default: ""; Description: Memory limit (e.g. 256mb); empty = unlimited
  • master.config.maxmemory_policy — Default: noeviction; Description: Memory policy (allkeys-lru for caches)
  • master.config.disabled_commands — Default: []; Description: Commands disabled via rename-command X ""
  • master.config.extra — Default: ""; Description: Additional raw config lines

Metrics

  • metrics.enabled — Default: false; Description: Add the redis_exporter sidecar and service port metrics (9121)
  • metrics.exporter.image — Default: ghcr.io/oliver006/redis_exporter:v1.97.0; Description: Exporter image
  • metrics.vmservicescrape.enabled — Default: false; Description: Create VMServiceScrape

Secrets

Set sensitive values via secrets.poly:

# secrets.poly
blocks:
  - name: valkey
    config:
      auth:
        password: "your-secure-password"

Connection

Host/Port:

Host: valkey-master.<namespace>.svc.cluster.local
Port: 6379

Connection String:

redis://:PASSWORD@valkey-master.<namespace>.svc.cluster.local:6379

CLI (inside the pod, password taken from VALKEYCLI_AUTH):

kubectl -n <namespace> exec valkey-master-0 -c valkey -- valkey-cli ping

Upgrade Notes (0.2.0)

  • Valkey 8.0 to 9.1: existing AOF/RDB data is read without migration.
  • The replica config section was removed (it never created replicas).
  • The pod is recreated once because of the new security context and checksum annotations.

Links