apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  selector:
    matchLabels:
      app: postgres
  replicas: 2
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:9.5-alpine
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        env:
        - name: POSTGRES_DB
          value: springbootdb
        - name: POSTGRES_USER
          valueFrom:
            secretKeyRef:
              name: db
              key: username
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: db
              key: password
        ports:
        - containerPort: 5432
