gcloud-lab/apps/base/customer1/trading-platform/redis-cluster.yaml
Hermes DevOps c587a707a6 feat(redis): add persistent volume for trading-redis
Replace emptyDir with 10Gi PVC (ReadWriteOnce) so hot cache
survives pod restarts.
2026-05-27 04:05:41 +00:00

118 lines
2.4 KiB
YAML

# Redis single-instance for trading platform caching
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: trading-redis-pvc
namespace: customer1
labels:
app: trading-redis
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
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
persistentVolumeClaim:
claimName: trading-redis-pvc