diff --git a/deploy/k8s/api-cache.yml b/deploy/k8s/api-cache.yml index 5c12812..2d4162b 100644 --- a/deploy/k8s/api-cache.yml +++ b/deploy/k8s/api-cache.yml @@ -1,4 +1,31 @@ apiVersion: v1 +kind: PersistentVolume +metadata: + name: api-cache-pv + namespace: egommerce +spec: + capacity: + storage: 5Gi + accessModes: + - ReadWriteOnce + storageClassName: api-cache-pv + hostPath: + path: "/home/keedosn/.egommerce/redis" # Ensure this path exists on the node +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: api-cache-pvc + namespace: egommerce +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi + storageClassName: api-cache-pv +--- +apiVersion: v1 kind: Service metadata: name: api-cache @@ -64,9 +91,16 @@ spec: memory: 512M ports: - containerPort: 6379 + volumeMounts: + - name: api-cache-data + mountPath: /data - name: api-cache-metrics image: oliver006/redis_exporter:latest args: - --redis.addr=redis://api-cache:6379 ports: - - containerPort: 9121 \ No newline at end of file + - containerPort: 9121 + volumes: + - name: api-cache-data + persistentVolumeClaim: + claimName: api-cache-pvc \ No newline at end of file