apiVersion: extensions/v1beta1 kind: Deployment metadata: name: postgres labels: k8s-app: postgres spec: replicas: 1 selector: matchLabels: k8s-app: postgres template: metadata: labels: k8s-app: postgres spec: containers: - image: {{image}} name: postgres env: - name: POSTGRES_PASSWORD value: "{{password}}" - name: PGPASSWORD value: "{{password}}" - name: POSTGRES_USER value: "{{user}}" - name: POSTGRES_DB value: "{{dbname}}" - name: PGDATA value: /var/lib/postgresql/data/pgdata ports: - containerPort: 5432 name: postgres volumeMounts: - name: postgres-data mountPath: /var/lib/postgresql/data # livenessProbe: # tcpSocket: # port: "postgres" # initialDelaySeconds: 5 # timeoutSeconds: 1 # readinessProbe: # initialDelaySeconds: 600 # exec: # command: ["psql", "-h", "localhost", "-U", "postgres"] volumes: {{data_volumes}}