Skip to main content
Version: 2.0.2

Redis API Reference

This reference details the use of Redis on Hikube, highlighting its speed and versatility as an in-memory data store and distributed cache system. The managed service simplifies Redis cluster deployment and management, guaranteeing high availability, low latency, and optimal performance for your applications.

The service is based on the Spotahome Redis Operator, which ensures orchestration, replication, and supervision of Redis clusters.


Base Structure​

Redis Resource​

YAML Configuration Example​

apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: example
spec:

Parameters​

Common Parameters​

ParameterTypeDescriptionDefault ValueRequired
replicasintNumber of Redis replicas (instances in the cluster)2Yes
resourcesobjectExplicit CPU and memory configuration for each Redis replica. If empty, resourcesPreset is applied{}No
resources.cpuquantityCPU available per replicanullNo
resources.memoryquantityRAM available per replicanullNo
resourcesPresetstringPredefined resource profile (nano, micro, small, medium, large, xlarge, 2xlarge)"nano"Yes
sizequantityPersistent volume (PVC) size for data1GiYes
storageClassstringStorage class used""No
externalboolEnable external access to the cluster (LoadBalancer)falseNo
authEnabledboolEnable password authentication (stored in a Kubernetes Secret)trueNo

YAML Configuration Example​

redis.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: example
spec:
# Number of Redis replicas (high availability if >1)
replicas: 3

# Resources allocated per instance
resources:
cpu: 1000m # 1 vCPU
memory: 1Gi # 1 GiB RAM

# Persistent disk size for each instance
size: 2Gi
storageClass: replicated

# Enable Redis authentication
# If true, a password is automatically generated
authEnabled: true

# Expose Redis service outside the cluster
external: true

Application-Specific Parameters​

ParameterTypeDescriptionDefault ValueRequired
authEnabledboolEnables password generation (stored in a Kubernetes Secret)trueNo

YAML Configuration Example​

redis.yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: Redis
metadata:
name: example
spec:
replicas: 3
resources:
cpu: 1000m
memory: 1Gi
size: 2Gi
storageClass: replicated
# Enable Redis authentication
# If true, a password is automatically generated
authEnabled: false
# Expose Redis service outside the cluster
external: false

resources and resourcesPreset​

The resources field allows explicitly defining the CPU and memory configuration of each Redis replica. If this field is left empty, the value of the resourcesPreset parameter is used.

YAML Configuration Example​

redis.yaml
resources:
cpu: 4000m
memory: 4Gi

Warning: if resources is defined, the resourcesPreset value is ignored.

Preset nameCPUMemory
nano250m128Mi
micro500m256Mi
small1512Mi
medium11Gi
large22Gi
xlarge44Gi
2xlarge88Gi

Best Practices
  • authEnabled: true: always enable authentication in production to secure access to your Redis data
  • 3 replicas minimum in production to ensure high availability with Redis Sentinel
  • Replicated storage: use storageClass: replicated to protect data against physical node loss
  • Memory sizing: the allocated memory (resources.memory) must be sufficient to hold your entire Redis dataset
Warning
  • Deletions are irreversible: deleting a Redis resource results in permanent data loss if no external persistence is configured
  • resources vs resourcesPreset: if resources is defined, resourcesPreset is entirely ignored
  • External access: enabling external: true exposes Redis to the Internet -- make sure authEnabled: true is configured