apiVersion: v1
kind: ReplicationController
metadata:
  name: db-controller
spec:
  replicas: 1
  selector:
    name: db
  template:
    spec:
      containers:
        - name: db
          image: postgres:9.5
          env:
            - name: POSTGRES_USER
              value: webapp
            - name: POSTGRES_PASSWORD
              value: webapp
          ports:
            - containerPort: 5432
          volumeMounts:
          - mountPath: /var/lib/postgresql/data
            name: "db-data"
          resources:
            requests:
              memory: "100Mi"
              cpu: "200m"
            limits:
              memory: "200Mi"
              cpu: "400m"
      volumes:
      - name: "db-data"
        hostPath:
          path: "/mnt/db"
    metadata:
      labels:
        name: db