add redis

This commit is contained in:
2025-03-30 14:09:32 +02:00
parent 0e5c6d4fae
commit 8bbd2ff08a
6 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- redis-lb.yaml
- redis-sentinel-configmap.yaml
- redis-sentinel-deploy.yaml
- redis-statefulset.yaml
- redis-svc.yaml

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-lb
namespace: redis
labels:
app: redis
spec:
selector:
app: redis
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: redis
type: ClusterIP

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-sentinel-config
namespace: redis
data:
sentinel.conf: |
port 26379
sentinel monitor mymaster redis-0.redis.grafana.svc.cluster.local 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 10000
sentinel parallel-syncs mymaster 1

View File

@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-sentinel
namespace: redis
labels:
app: redis-sentinel
spec:
replicas: 3
selector:
matchLabels:
app: redis-sentinel
template:
metadata:
labels:
app: redis-sentinel
spec:
containers:
- name: redis-sentinel
image: redis:6.2-alpine
ports:
- containerPort: 26379
name: sentinel
command:
- "redis-sentinel"
- "/etc/redis/sentinel.conf"
volumeMounts:
- name: sentinel-config
mountPath: /etc/redis
volumes:
- name: sentinel-config
configMap:
name: redis-sentinel-config

View File

@@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
namespace: redis
labels:
app: redis
spec:
serviceName: "redis"
replicas: 3
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2-alpine
ports:
- containerPort: 6379
name: redis
command:
- "redis-server"
- "--appendonly"
- "yes"
volumeMounts:
- name: data
mountPath: /data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: longhorn
resources:
requests:
storage: 5Gi

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: redis
labels:
app: redis
spec:
ports:
- port: 6379
name: redis
clusterIP: None
selector:
app: redis