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
emptyDirfor 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/MODULEcommands disabled - Metrics via a
redis_exportersidecar 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 Kubernetesuninstall— Remove Valkey from Kubernetesstatus— Show deployment statusinfo— Show configuration
polycrate run valkey install
polycrate run valkey status
polycrate run valkey uninstall
Configuration
Basic Settings
namespace— Default:valkey; Description: Kubernetes namespacearchitecture— Default:standalone; Description: Onlystandaloneis supported; install fails otherwise
Image Configuration
image_registry— Default:docker.io; Description: Container registryimage_name— Default:valkey/valkey; Description: Image nameimage_tag— Default:""; Description: Tag (defaults toapp_version)
Authentication
auth.enabled— Default:true; Description: Enable password authenticationauth.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 portmaster.persistence.enabled— Default:true; Description: Enable PVC;falseuses anemptyDirmaster.persistence.size— Default:8Gi; Description: PVC sizemaster.persistence.storage_class— Default:""; Description: Storage class
Valkey Configuration
master.config.appendonly— Default:yes; Description: Enable AOF persistencemaster.config.save— Default:""; Description: RDB save configurationmaster.config.maxmemory— Default:""; Description: Memory limit (e.g.256mb); empty = unlimitedmaster.config.maxmemory_policy— Default:noeviction; Description: Memory policy (allkeys-lrufor caches)master.config.disabled_commands— Default:[]; Description: Commands disabled viarename-command X ""master.config.extra— Default:""; Description: Additional raw config lines
Metrics
metrics.enabled— Default:false; Description: Add theredis_exportersidecar and service portmetrics(9121)metrics.exporter.image— Default:ghcr.io/oliver006/redis_exporter:v1.97.0; Description: Exporter imagemetrics.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
replicaconfig section was removed (it never created replicas). - The pod is recreated once because of the new security context and checksum annotations.