k3s/namespaces/core/redis.yaml

83 lines
1.5 KiB
YAML
Raw Normal View History

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
namespace: core
spec:
serviceName: redis
replicas: 1
selector:
matchLabels:
name: redis
template:
metadata:
labels:
name: redis
spec:
restartPolicy: Always
containers:
- name: redis
image: redis:7.4.2-alpine3.21
ports:
- name: http
containerPort: 6379
protocol: TCP
volumeMounts:
- mountPath: /data
name: redis-data
subPath: "data"
volumeClaimTemplates:
- metadata:
name: redis-data
annotations:
name: redis-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn-private
resources:
requests:
storage: 0.5Gi
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: core
spec:
type: ClusterIP
selector:
name: redis
ports:
- port: 6379
name: http
targetPort: http
protocol: TCP
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: redis
namespace: core
spec:
parentRefs:
- name: homelab-gateway
sectionName: redis
kind: Gateway
namespace: homelab
hostnames:
- redis.leechpepin.local
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: redis
namespace: core
port: 6379