# Redis single-instance for trading platform caching apiVersion: v1 kind: Service metadata: name: trading-redis namespace: customer1 labels: app: trading-redis spec: selector: app: trading-redis ports: - port: 6379 targetPort: 6379 name: redis type: ClusterIP --- apiVersion: v1 kind: ConfigMap metadata: name: trading-redis-config namespace: customer1 data: redis.conf: | maxmemory 256mb maxmemory-policy allkeys-lru save 900 1 save 300 10 save 60 10000 appendonly yes appendfsync everysec dir /data --- apiVersion: apps/v1 kind: Deployment metadata: name: trading-redis namespace: customer1 labels: app: trading-redis spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: trading-redis template: metadata: labels: app: trading-redis spec: securityContext: runAsNonRoot: true runAsUser: 999 fsGroup: 999 containers: - name: redis image: redis:7.4-alpine ports: - containerPort: 6379 name: redis args: - redis-server - /etc/redis/redis.conf resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 512Mi securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: - ALL volumeMounts: - name: config mountPath: /etc/redis - name: data mountPath: /data readinessProbe: exec: command: - redis-cli - ping initialDelaySeconds: 5 periodSeconds: 5 livenessProbe: exec: command: - redis-cli - ping initialDelaySeconds: 10 periodSeconds: 10 volumes: - name: config configMap: name: trading-redis-config - name: data emptyDir: {}