woj-server/resource/deploy/cache.yaml
2024-01-06 20:27:28 +08:00

70 lines
1.3 KiB
YAML

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: woj
name: cache-pvc
labels:
app: cache
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: woj
name: cache-deployment
labels:
app: cache
spec:
selector:
matchLabels:
app: cache
template:
metadata:
namespace: woj
name: cache-pod
labels:
app: cache
spec:
containers:
- name: cache
image: docker.io/bitnami/redis:7.2
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6379
env:
- name: REDIS_PASSWORD
valueFrom:
configMapKeyRef:
name: shared-config
key: REDIS_PASSWORD
volumeMounts:
- name: cache-vol
mountPath: /data
volumes:
- name: cache-vol
persistentVolumeClaim:
claimName: cache-pvc
---
apiVersion: v1
kind: Service
metadata:
namespace: woj
name: cache-service
labels:
app: cache
spec:
# for production use ClusterIP
type: LoadBalancer
selector:
app: cache
ports:
- protocol: TCP
port: 6379
targetPort: 6379