RedisApplication construct deploys Redis instances to Kubernetes with support for data persistence, custom configuration, and automatic volume management.
Constructor
Properties
Deployment configuration. Defaults are:
image:"redis"tag:"6.0"port:6379
Port to expose Redis on. Standard Redis port is 6379.
Whether to create a Kubernetes service account and attach it to deployment pods.
Enable data persistence using a PersistentVolumeClaim. When enabled:
- Creates an AWS EBS-backed storage class (gp3)
- Creates a 1Gi PersistentVolumeClaim with ReadWriteOnce access
- Mounts volumes at
/redis-master-data(data) and/redis-master(config) - Runs Redis with custom config:
redis-server /redis-master/redis.conf
Override the default Redis configuration by providing a custom ConfigMap.Properties:
name(string): Name for the ConfigMapconfig(string): Redis configuration content
/redis-master/redis.conf.Behavior
Default Configuration
By default,RedisApplication creates a basic Redis instance without persistence:
- Uses
redis:6.0image - Exposes port 6379
- No data persistence (data lost on pod restart)
With Persistence
WhenpersistData: true:
- StorageClass: Creates
{releaseName}-{appname}-storageusing AWS EBS CSI driver (gp3) - PersistentVolumeClaim: Creates
{releaseName}-{appname}-pvcwith 1Gi storage - Volumes: Mounts data and config volumes
- Command: Runs
redis-server /redis-master/redis.conf
Custom Configuration
WhenredisConfigMap is provided, a ConfigMap is created with your Redis configuration, which is mounted into the Redis container.
Usage Examples
Basic Redis (No Persistence)
Example from the Kittyhawk README:redis:6379 within the cluster.
Redis with Persistence
Redis with Custom Version
Redis with Custom Port
Redis with Persistence and Custom Config
Redis with Custom Resources
Connecting to Redis
From your application, connect to Redis using the service name:Storage Details
When persistence is enabled:- Storage Class:
ebs.csi.aws.comprovisioner (AWS EBS) - Volume Type: gp3 (General Purpose SSD)
- Size: 1Gi (modifiable by extending the construct)
- Access Mode: ReadWriteOnce (required for AWS EBS)
- Binding Mode: WaitForFirstConsumer (ensures volume is created in the same zone as the pod)
Volume Mounts
WithpersistData: true:
Related
- Deployments - Configuration options for the underlying deployment
- DjangoApplication - Often used with Redis for caching