Skip to content

Commit

Permalink
Persist redis data across restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
Katharine committed Jul 23, 2023
1 parent c445475 commit 3818458
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions cluster/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
name: redis-persist
spec:
serviceName: "redis"
replicas: 1
selector:
matchLabels:
app: redis
app: redis-persist
template:
metadata:
labels:
app: redis
app: redis-persist
spec:
containers:
- name: redis
image: redis:7.0
args:
- --requirepass
- $(REDIS_PASS)
- --save
- ""
- --dir
- /redis-data/
- --appendonly
- "yes"
- --auto-aof-rewrite-percentage
- "100"
- --auto-aof-rewrite-min-size
- 64mb
env:
- name: REDIS_PASS
valueFrom:
Expand All @@ -37,6 +43,23 @@ spec:
requests:
cpu: 10m
memory: 128Mi
volumeMounts:
- name: redis-storage
mountPath: /redis-data
securityContext:
fsGroup: 999
runAsUser: 999
runAsGroup: 999
volumeClaimTemplates:
- metadata:
name: redis-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: standard-rwo
---
apiVersion: v1
kind: Service
Expand All @@ -49,4 +72,4 @@ spec:
- port: 6379
name: redis
selector:
app: redis
app: redis-persist

0 comments on commit 3818458

Please sign in to comment.