Skip to main content

FAQ β€” Redis

How does Redis Sentinel work on Hikube?​

Redis on Hikube is deployed via the Spotahome Redis Operator, which sets up a Redis Sentinel architecture for high availability:

  • Redis Sentinel monitors Redis instances and performs automatic failover when the primary fails.
  • A quorum is required to decide on failover: you need at least 3 replicas to guarantee a working quorum (majority of 2 out of 3).
  • Clients should connect via the Sentinel service to benefit from automatic failover.
redis.yaml
spec:
replicas: 3 # Minimum recommended for Sentinel quorum
tip

In production, always use at least 3 replicas to ensure proper Sentinel quorum operation.

What is the difference between resourcesPreset and resources?​

The resourcesPreset field lets you choose a predetermined resource profile for each Redis replica. If the resources field (explicit CPU/memory) is defined, resourcesPreset is completely ignored.

PresetCPUMemory
nano250m128Mi
micro500m256Mi
small1512Mi
medium11Gi
large22Gi
xlarge44Gi
2xlarge88Gi
redis.yaml
spec:
# Using a preset
resourcesPreset: small

# OR explicit configuration (the preset is then ignored)
resources:
cpu: 1000m
memory: 1Gi

Does Redis persist data?​

Yes. Redis on Hikube uses RDB/AOF persistence combined with persistent volumes (PVC). Data is written to disk and survives pod restarts.

The storageClass choice affects durability:

  • local: data persisted on the physical node. Fast but vulnerable to node failure. Recommended if replicas > 1 (Redis Sentinel replication already ensures HA).
  • replicated: data replicated across multiple nodes. Slower but resilient to failures. Recommended if replicas = 1 (replicated storage compensates for the lack of application replication).
redis.yaml
spec:
size: 2Gi
storageClass: local # If replicas > 1 (Sentinel ensures HA)

What is the authEnabled parameter for?​

When authEnabled is set to true (default value), a password is automatically generated and stored in a Kubernetes Secret. This password is required for any connection to Redis.

redis.yaml
spec:
authEnabled: true # Default value
warning

Always enable authEnabled: true in production. Disabling authentication exposes your data to any pod that can access the Redis service.

How to scale Redis?​

To increase the number of Redis replicas, modify the replicas field in your manifest and apply the change:

redis.yaml
spec:
replicas: 5 # Increase the number of replicas
kubectl apply -f redis.yaml

Redis Sentinel automatically reconfigures the cluster to integrate the new replicas. No manual intervention is required.

How to connect to Redis from a pod?​

  1. Get the password from the Secret (if authEnabled: true):

    kubectl get tenantsecret redis-<name>-auth -o jsonpath='{.data.password}' | base64 -d
  2. Connect via the Sentinel service (recommended for automatic failover):

    # Sentinel service
    redis-cli -h rfs-redis-<name> -p 26379 SENTINEL get-master-addr-by-name mymaster
  3. Or connect directly to the Redis service:

    # Direct service
    redis-cli -h rfr-redis-<name> -p 6379 -a <password>
tip

Prefer connecting via the Sentinel service (rfs-redis-<name>) so your applications automatically follow the primary during failover.