132 lines
2.5 KiB
YAML
132 lines
2.5 KiB
YAML
# Simple Redis deployment for conversation storage
|
|
# For production, consider using:
|
|
# - Redis Operator (e.g., Redis Enterprise Operator)
|
|
# - Managed Redis (AWS ElastiCache, GCP Memorystore, Azure Cache for Redis)
|
|
# - Redis Cluster for high availability
|
|
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: redis-config
|
|
namespace: llm-gateway
|
|
labels:
|
|
app: redis
|
|
data:
|
|
redis.conf: |
|
|
maxmemory 256mb
|
|
maxmemory-policy allkeys-lru
|
|
save ""
|
|
appendonly no
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: redis
|
|
namespace: llm-gateway
|
|
labels:
|
|
app: redis
|
|
spec:
|
|
serviceName: redis
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: redis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: redis
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 999
|
|
fsGroup: 999
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
|
|
containers:
|
|
- name: redis
|
|
image: redis:7.2-alpine
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
command:
|
|
- redis-server
|
|
- /etc/redis/redis.conf
|
|
|
|
ports:
|
|
- name: redis
|
|
containerPort: 6379
|
|
protocol: TCP
|
|
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 512Mi
|
|
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: redis
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- redis-cli
|
|
- ping
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /etc/redis
|
|
- name: data
|
|
mountPath: /data
|
|
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
runAsNonRoot: true
|
|
runAsUser: 999
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: redis-config
|
|
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
resources:
|
|
requests:
|
|
storage: 10Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: redis
|
|
namespace: llm-gateway
|
|
labels:
|
|
app: redis
|
|
spec:
|
|
type: ClusterIP
|
|
clusterIP: None
|
|
selector:
|
|
app: redis
|
|
ports:
|
|
- name: redis
|
|
port: 6379
|
|
targetPort: redis
|
|
protocol: TCP
|