RedisCluster

Configurations and parameters for Redis cluster

Redis cluster can be customized by values.yaml. The recommended way of managing the setup is using helm but if the setup is not maintained by it, YAML CRD parameters can be modified in the manifest.

Helm Configuration Parameters

Key Type Default Description
TLS.ca string "ca.key"
TLS.cert string "tls.crt"
TLS.key string "tls.key"
TLS.secret.secretName string ""
acl.secret.secretName string ""
env list []
externalConfig.data string "tcp-keepalive 400\nslowlog-max-len 158\nstream-node-max-bytes 2048\n"
externalConfig.enabled bool false
externalService.enabled bool false
externalService.port int 6379
externalService.serviceType string "LoadBalancer"
initContainer.args list []
initContainer.command list []
initContainer.enabled bool false
initContainer.env list []
initContainer.image string ""
initContainer.imagePullPolicy string "IfNotPresent"
initContainer.resources object {}
labels object {}
podSecurityContext.fsGroup int 1000
podSecurityContext.runAsUser int 1000
priorityClassName string ""
redisCluster.clusterSize int 3
redisCluster.clusterVersion string "v7"
redisCluster.follower.affinity string nil
redisCluster.follower.nodeSelector string nil
redisCluster.follower.pdb.enabled bool false
redisCluster.follower.pdb.maxUnavailable int 1
redisCluster.follower.pdb.minAvailable int 1
redisCluster.follower.replicas int 3
redisCluster.follower.securityContext object {}
redisCluster.follower.serviceType string "ClusterIP"
redisCluster.follower.tolerations list []
redisCluster.image string "quay.io/opstree/redis"
redisCluster.imagePullPolicy string "IfNotPresent"
redisCluster.imagePullSecrets object {}
redisCluster.leader.affinity object {}
redisCluster.leader.nodeSelector string nil
redisCluster.leader.pdb.enabled bool false
redisCluster.leader.pdb.maxUnavailable int 1
redisCluster.leader.pdb.minAvailable int 1
redisCluster.leader.replicas int 3
redisCluster.leader.securityContext object {}
redisCluster.leader.serviceType string "ClusterIP"
redisCluster.leader.tolerations list []
redisCluster.minReadySeconds int 0
redisCluster.name string ""
redisCluster.persistenceEnabled bool true
redisCluster.recreateStatefulSetOnUpdateInvalid bool false Some fields of statefulset are immutable, such as volumeClaimTemplates. When set to true, the operator will delete the statefulset and recreate it. Default is false.
redisCluster.redisSecret.secretKey string ""
redisCluster.redisSecret.secretName string ""
redisCluster.resources object {}
redisCluster.tag string "v7.0.15"
redisExporter.enabled bool false
redisExporter.env list []
redisExporter.image string "quay.io/opstree/redis-exporter"
redisExporter.imagePullPolicy string "IfNotPresent"
redisExporter.resources object {}
redisExporter.tag string "v1.44.0"
serviceAccountName string ""
serviceMonitor.enabled bool false
serviceMonitor.interval string "30s"
serviceMonitor.namespace string "monitoring"
serviceMonitor.scrapeTimeout string "10s"
sidecars.env object {}
sidecars.image string ""
sidecars.imagePullPolicy string "IfNotPresent"
sidecars.name string ""
sidecars.resources.limits.cpu string "100m"
sidecars.resources.limits.memory string "128Mi"
sidecars.resources.requests.cpu string "50m"
sidecars.resources.requests.memory string "64Mi"
storageSpec.nodeConfVolume bool true
storageSpec.nodeConfVolumeClaimTemplate.spec.accessModes[0] string "ReadWriteOnce"
storageSpec.nodeConfVolumeClaimTemplate.spec.resources.requests.storage string "1Gi"
storageSpec.volumeClaimTemplate.spec.accessModes[0] string "ReadWriteOnce"
storageSpec.volumeClaimTemplate.spec.resources.requests.storage string "1Gi"

RedisCluster Instance Configuration

Dynamic Configuration

Redis Operator supports dynamic configuration for Redis instances in a cluster through the top-level redisConfig field. You can set Redis configuration parameters that can be modified at runtime without requiring a restart.

Example Configuration

apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisCluster
metadata:
  name: redis-cluster
spec:
  redisConfig:
    dynamicConfig:
      - "maxmemory-policy allkeys-lru"
      - "slowlog-log-slower-than 5000"

Configuration Application

  • Dynamic configurations are applied to all Redis instances (both leaders and followers) in the cluster
  • The operator ensures all accessible instances receive the configuration
  • If an instance is not ready or accessible, it will be skipped and retried in the next reconciliation
  • Configuration changes are applied only when the cluster is in a ready state

Important Notes

  1. Configuration Validation

    • Ensure the configuration parameters are supported by your Redis version
    • Use proper format: “parameter value” (e.g., “maxmemory-policy allkeys-lru”)
    • Invalid configurations will be logged and skipped
  2. Monitoring

    • Configuration changes are logged at the pod level
    • Check pod logs for configuration status and any errors
    • Use kubectl exec to verify configurations:
      kubectl exec -it <pod-name> -- redis-cli CONFIG GET <parameter>
      
  3. Best Practices

    • Use dynamic configuration for parameters that need to be consistent across the cluster
    • Test configuration changes in non-production environments first
  4. Limitations

    • Only supports parameters that can be modified at runtime

Last modified February 18, 2025: feat: add dynamic Redis configuration support for Redis Cluster (#1241) (230bb79)