<p>I have the following <strong>YAML</strong> file for create a postgres server instance</p>

<pre><code>kind: Deployment
apiVersion: apps/v1beta1
metadata: 
 name: spring-demo-db
 labels: 
  app: spring-demo-application
spec: 
 replicas: 1
 selector: 
  matchLabels: 
   app: spring-demo-db
 template: 
  metadata: 
   creationTimestamp: null
   labels: 
    app: spring-demo-db
  spec: 
   containers: 
    - name: spring-demo-db
      image: postgres:10.4
      ports: 
      - name: spring-demo-db
        containerPort: 5432
        protocol: TCP
      env: 
      - name: POSTGRES_PASSWORD
        value: "springdemo"
      - name: POSTGRES_USER
        value: "springdemo"
      - name: POSTGRES_DB
        value: "springdemo"
      volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgres-storage
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
   volumes: 
    - name: "postgres-storage"
      persistentVolumeClaim: 
       claimName: spring-demo-pv-claim   
   restartPolicy: Always
</code></pre>

<p>But when ssh into the container user <strong>springdemo</strong> not created. I have been struggling all day.What could be the problem for this </p>

<p>Anyone who can help me?</p>

Navigator
<p>You didn't mention what command you're running and what error you're getting, so I'm guessing here, but try this:</p>

<pre><code>kind: Deployment
apiVersion: apps/v1beta1
metadata: 
 name: spring-demo-db
 labels: 
  app: spring-demo-application
spec: 
 replicas: 1
 selector: 
  matchLabels: 
   app: spring-demo-db
 template: 
  metadata: 
   creationTimestamp: null
   labels: 
    app: spring-demo-db
  spec: 
   containers: 
    - name: spring-demo-db
      image: postgres:10.4
      ports: 
      - name: spring-demo-db
        containerPort: 5432
        protocol: TCP
      env: 
      - name: POSTGRES_USER
        value: "springdemo"
      - name: POSTGRES_DB
        value: "springdemo"
      - name: POSTGRES_PASSWORD
        value: "springdemo"
      volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgres-storage
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      imagePullPolicy: IfNotPresent
   volumes: 
    - name: "postgres-storage"
      persistentVolumeClaim: 
       claimName: spring-demo-pv-claim   
   restartPolicy: Always
</code></pre>

<p>But if it doesn't work, just use the <a href="https://github.com/helm/charts/tree/master/stable/postgresql" rel="nofollow noreferrer">Helm chart</a>, because, among other issues, you are passing the password in an insecure way, which is a bad idea.</p>
