Skip to main content
The Redis service provides caching and pub/sub messaging capabilities for the exchange platform.

Deployment Configuration

apiVersion: apps/v1
kind: Deployment
metadata:
  name: exchange-redis-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: exchange-redis
  template:
    metadata:
      labels:
        app: exchange-redis
    spec:
      containers:
        - name: exchange-redis
          image: redis:6.2-alpine
          ports:
            - containerPort: 6379
          volumeMounts:
            - mountPath: /data
              subPath: redis-data
              name: redis-storage
      volumes:
        - name: redis-storage
          persistentVolumeClaim:
            claimName: redis-pvc

Service Configuration

apiVersion: v1
kind: Service
metadata:
  name: exchange-redis-service
spec:
  selector:
    app: exchange-redis
  ports:
    - protocol: TCP
      port: 80
      targetPort: 6379
  type: ClusterIP

Persistent Volume Claim

Redis uses persistent storage to maintain data across restarts:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: redis-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: standard-rwo
  volumeMode: Filesystem

Service Details

ParameterValue
Imageredis:6.2-alpine
Container Port6379
Service Port80
Replicas1
Service TypeClusterIP

Storage Configuration

ParameterValue
Storage Classstandard-rwo
Access ModeReadWriteOnce
Storage Size5Gi
Mount Path/data
SubPathredis-data

Connection URL

Services can connect to Redis using:
redis://exchange-redis-service.default.svc.cluster.local:80

Use Cases

The Redis service is used for:
  • Caching: Fast access to frequently accessed data
  • Pub/Sub: Real-time message distribution for WebSocket streams
  • Session Storage: Temporary session data
  • Queue Management: Task queuing for asynchronous processing

Data Persistence

Redis data is persisted to a PersistentVolume at /data, ensuring that cached data and pub/sub state survive pod restarts. The Alpine-based image provides a lightweight deployment footprint.

Performance Considerations

  • Single replica deployment for simplicity
  • Persistent storage ensures data durability
  • ClusterIP service type for internal-only access
  • 5Gi storage allocation for cache and messaging data

Build docs developers (and LLMs) love