apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  namespace: vzzpr-backend
  labels:
    app: redis
    version: v7.0
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
        version: v7.0
    spec:
      containers:
        - name: redis
          image: redis:7-alpine
          imagePullPolicy: Always
          command: ["redis-server", "--port", "6370"]
          ports:
            - containerPort: 6370
              name: redis
              protocol: TCP
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
            limits:
              cpu: "1"
              memory: "1Gi"
          livenessProbe:
            exec:
              command:
                - redis-cli
                - -p
                - "6370"
                - ping
            initialDelaySeconds: 30
            periodSeconds: 30
            timeoutSeconds: 10
            failureThreshold: 3
          readinessProbe:
            exec:
              command:
                - redis-cli
                - -p
                - "6370"
                - ping
            initialDelaySeconds: 10
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsUser: 999
            capabilities:
              drop:
                - ALL
---
apiVersion: v1
kind: Service
metadata:
  name: redis
  namespace: vzzpr-backend
  labels:
    app: redis
spec:
  selector:
    app: redis
  ports:
    - port: 6370
      targetPort: 6370
      protocol: TCP
      name: redis
  type: ClusterIP 