apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: 
    k8s-app-postgres
  labels:
    pv: pv-ghost
spec:
  serviceName: k8s-app-postgres
  replicas: 1
  selector:
    matchLabels:
      app: k8s-app-postgres
  template:
    metadata:
      labels:
        app: k8s-app-postgres
        name: postgres-pv
    spec:
      containers:
       - name: k8s-app-postgres
         image: dock101/postgres-sample:latest
         imagePullPolicy: IfNotPresent
         ports:
          - containerPort: 5432
         env:
          - name: POSTGRES_DB
            value: "db"  
          - name: POSTGRES_HOST_AUTH_METHOD
            value: "trust"                      
         volumeMounts: 
           - name: localvolume
             mountPath: /usr/local/pgsql/data
      volumes:
        - name: localvolume
          persistentVolumeClaim:
            claimName: postgres-pvc
      nodeSelector:         
        kubernetes.io/hostname: ip-10-2-0-82
