Skip to content

Valkey API Reference

Overview

The Valkey resource is a unified API for deploying and managing Valkey instances in different architectures, such as cluster and failover modes. It simplifies the user experience by providing a single entry point for various Valkey setups.

Resource Definition

apiVersion: rds.valkey.buf.red/v1alpha1
kind: Valkey
metadata:
  name: my-valkey
  namespace: default
spec:
  # Valkey specification
status:
  # Valkey status

ValkeySpec

Field Type Description
version string Valkey version to use. Supported (stable): "7.2", "8.0", "8.1", "9.0", "9.1".
arch core.Arch Architecture (cluster, failover, replica)
replicas *ValkeyReplicas Desired number of replicas for Valkey
resources corev1.ResourceRequirements Resource requirements
customConfigs map[string]string Custom Valkey configuration
modules []core.ValkeyModule Valkey modules to load
storage *core.Storage Storage configuration
access core.InstanceAccess Access configuration
podAnnotations map[string]string Pod annotations
affinityPolicy *core.AffinityPolicy Affinity policy
customAffinity *corev1.Affinity Custom affinity rules
nodeSelector map[string]string Node selector
tolerations []corev1.Toleration Pod tolerations
securityContext *corev1.PodSecurityContext Pod security context
exporter *ValkeyExporter Monitoring exporter configuration
sentinel *SentinelSettings Sentinel configuration (for failover arch); sentinel.overwrites patches the sentinel StatefulSet, PodDisruptionBudget and Services
overwrites []core.Overwrite Patches for the StatefulSets, PodDisruptionBudgets and Services the operator generates for the Valkey nodes

ValkeyReplicas

Field Type Description
shards int32 Number of cluster shards (for cluster arch)
shardsConfig []*v1alpha1.ShardConfig Configuration for each shard
replicasOfShard int32 Number of pods in each shard, the primary included: 1 runs the primary alone, 2 adds one replica

ValkeyStatus

Field Type Description
phase ValkeyPhase Current phase of the Valkey instance
message string Status message
matchLabels map[string]string Matching labels selector for Valkey
nodes []core.ValkeyNode Valkey node details
lastShardCount int32 Last number of shards in the cluster
lastVersion string Last version of the Valkey instance

Example: Cluster Mode

apiVersion: rds.valkey.buf.red/v1alpha1
kind: Valkey
metadata:
  name: example-valkey-cluster
  namespace: valkey-system
spec:
  arch: cluster
  version: "8.0"
  replicas:
    shards: 3
    replicasOfShard: 1
  resources:
    requests:
      memory: "1Gi"
      cpu: "500m"
    limits:
      memory: "2Gi"
      cpu: "1000m"

Example: Failover Mode

apiVersion: rds.valkey.buf.red/v1alpha1
kind: Valkey
metadata:
  name: example-valkey-failover
  namespace: valkey-system
spec:
  arch: failover
  version: "8.0"
  replicas:
    replicasOfShard: 3
  sentinel:
    replicas: 3
    quorum: 2
  resources:
    requests:
      memory: "512Mi"
      cpu: "250m"