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 namespace: egommerce labels: app: api-cache spec: type: NodePort selector: app: api-cache ports: - port: 6379 nodePort: 31300 # --- # apiVersion: v1 # kind: Service # metadata: # name: api-cache-metrics # namespace: egommerce # labels: # app: api-cache # spec: # type: NodePort # selector: # app: api-cache # ports: # - port: 9121 # nodePort: 31301 --- apiVersion: apps/v1 kind: Deployment metadata: name: api-cache namespace: egommerce spec: replicas: 1 selector: matchLabels: app: api-cache template: metadata: labels: app: api-cache spec: containers: - name: api-cache image: git.ego.freeddns.org/egommerce/api-cache:dev imagePullPolicy: Always command: [ "redis-server" ] args: [ "/etc/redis.conf" ] env: - name: APP_NAME value: api-cache - name: REDIS_PASSWORD value: "12345678" resources: limits: cpu: "1" 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 volumes: - name: api-cache-data persistentVolumeClaim: claimName: api-cache-pvc