Use Redis Flex on Kubernetes
Deploy a cluster with Redis Flex on Kubernetes.
| Redis Enterprise for Kubernetes |
|---|
Overview
Redis Flex (previously known as Redis on Flash) extends your node memory to use both RAM and flash storage. Solid state drives (SSDs) store infrequently used (warm) keys and values, while RAM stores frequently used (hot) keys and values. This approach improves performance and lowers costs for large datasets.
Redis Flex provides automatic RAM management and improved performance compared to Auto Tiering.
Redis Flex vs Auto Tiering
Before creating your Redis clusters or databases, these SSDs must be:
The earlier implementation of Redis Flex is called Auto Tiering, which is available in Redis versions earlier than 8.0.
The operator automatically selects the appropriate implementation based on your Redis version:
- Versions 7.22.2-22 and earlier: Auto Tiering
- Versions 8.0.2-2 and later: Redis Flex
Redis Flex differs from Auto Tiering in the following ways:
Redis Flex (8.0.2-2 and later)
- Storage engine: Speedb only
- RAM management: Automatic. Redis manages RAM allocation internally.
- Configuration:
rofRamSizeisn't validated with minimum ratio requirements. - Redis versions: Redis 8.0 and later
Auto Tiering ( 7.22.2-22 and earlier)
- Storage engine: RocksDB or Speedb
- RAM management: Manual. Requires explicit
rofRamSizeconfiguration. - Validation:
rofRamSizemust be at least 10% ofmemorySizeand can't exceedmemorySize. - Redis versions: Redis versions earlier than 8.0
The operator doesn't support Redis 7.4 preview for Redis Flex. Redis 7.4 databases use Auto Tiering regardless of cluster policy. To use Redis Flex, upgrade to Redis 8.0 or later.
Prerequisites
Before you create your Redis clusters or databases, ensure that your SSDs meet the following requirements:
- Locally attached to worker nodes in your Kubernetes cluster
- Formatted and mounted on the nodes that run Redis Enterprise pods
- Dedicated to Redis Flex and not shared with other parts of the database (for example, durability or binaries)
- Provisioned as local persistent volumes
- You can use a local volume provisioner to provision volumes dynamically.
- Configured with a StorageClass resource that has a unique name
For more information about node storage, see Node persistent and ephemeral storage.
Create a Redis Enterprise cluster
To deploy a Redis Enterprise cluster (REC) with Redis Flex, specify the following fields in the redisOnFlashSpec section of your REC custom resource:
enabled: true- Enables Redis FlexbigStoreDriver: speedb- Sets the flash storage driverstorageClassName- Specifies the storage class nameflashDiskSize- Sets the minimum flash disk size
enablePersistentVolumeResize in the REC persistentSpec if you use redisOnFlashSpec. Enabling both will cause conflicts.The following example shows a Redis Enterprise cluster custom resource with these fields:
apiVersion: app.redislabs.com/v1
kind: RedisEnterpriseCluster
metadata:
name: "rec"
labels:
app: redis-enterprise
spec:
nodes: 3
redisOnFlashSpec:
enabled: true
bigStoreDriver: speedb # Only 'speedb' is suitable for Redis Flex
storageClassName: local-scsi
flashDiskSize: 100G
- Set the
enabledfield totrue. - Use
bigStoreDriver: speedbfor Redis Flex support on Redis 8.0 and later. - The
flashStorageEnginefield is deprecated. UsebigStoreDriverinstead.
Create a Redis Enterprise database
By default, new databases use RAM only. To create a Redis Enterprise database (REDB) that uses Redis Flex and takes advantage of locally attached SSDs, set isRof to true.
Specify the following fields in the REDB custom resource:
isRof: true- Enables Redis FlexredisVersion- Set to"8.0"or latermemorySize- Defines the total combined memory size (RAM + flash)rofRamSize- (Optional) Defines the RAM capacity for the database
The following example shows a REDB custom resource:
apiVersion: app.redislabs.com/v1alpha1
kind: RedisEnterpriseDatabase
metadata:
name: redis-flex-db
spec:
redisEnterpriseCluster:
name: rec
isRof: true
redisVersion: "8.0"
memorySize: 2GB
rofRamSize: 0.5GB
rofRamSize, but it isn't subject to the 10% minimum ratio requirement that applies to Auto Tiering. The operator doesn't validate or enforce minimum RAM ratios for Redis 8.0 and later databases.Upgrade from Auto Tiering to Redis Flex
When you upgrade a database from a Redis version earlier than 8.0 to Redis 8.0 or later, Redis Server automatically migrates the database from Auto Tiering to Redis Flex. The operator detects this migration and makes the following changes:
- Stops validating the
rofRamSizeratio requirement. - Stops reconciling the
bigstore_ram_sizefield to avoid configuration drift. - Continues to preserve the database configuration.
Example upgrade scenario
The following example shows how to upgrade a database from Auto Tiering to Redis Flex:
- Create a database on Redis 7.2 with
rofRamSize: 200MB. - Upgrade the database to Redis 8.0 by updating
spec.redisVersionto"8.0". - Redis Server automatically converts the database to Redis Flex.
- The operator detects the conversion and adapts its reconciliation behavior.
- Redis now manages the
rofRamSizefield automatically. You can keep the field in the spec for backward compatibility.