---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: db-cache
  name: datastores
  namespace: atat
spec:
  selector:
    matchLabels:
      app: db-cache
  replicas: 1
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: db-cache
    spec:
      securityContext:
        fsGroup: 101
      containers:
        - name: postgres
          image: postgres:11-alpine
          imagePullPolicy: Never
          ports:
          - containerPort: 5432
        - name: redis
          image: redis:5.0-alpine
          imagePullPolicy: Never
          ports:
          - containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
  name: postgres-svc
  namespace: atat
spec:
  ports:
  - name: db-port
    protocol: "TCP"
    port: 5432
    targetPort: 5432
  selector:
    app: db-cache
---
apiVersion: v1
kind: Service
metadata:
  name: redis-svc
  namespace: atat
spec:
  ports:
  - name: cache-port
    protocol: "TCP"
    port: 6379
    targetPort: 6379
  selector:
    app: db-cache
