<p>I have below StatefulSet postgres for EKS. When I run it I am getting below error.</p>

<pre><code>Events:
  Type     Reason        Age               From                    Message
  ----     ------        ----              ----                    -------
   Warning  FailedCreate  7s (x17 over 1m)  statefulset-controller  create Pod postgres-0 in StatefulSet postgres failed error: Pod "postgres-0" is invalid: spec.containers[0].volumeMounts[0].name: Not found: "postgredb" 
</code></pre>

<p>StatefulSet:</p>

<pre><code>  apiVersion: apps/v1
  kind: StatefulSet
  metadata:
    name: postgres
  spec:
    selector:
      matchLabels:
        app: postgres # has to match .spec.template.metadata.labels
    serviceName: "postgres"
    replicas: 1
    template:
      metadata:
        labels:
          app: postgres
      spec:
        terminationGracePeriodSeconds: 10
        containers:
          - name: postgres
            image: postgres:10.4
            imagePullPolicy: "IfNotPresent"
            ports:
              - containerPort: 5432
            volumeMounts:
              - name: postgredb
                mountPath: /var/lib/postgresql/data
    volumeClaimTemplates:
      - metadata:
          name: postgresdb
          annotations:
            volume.beta.kubernetes.io/storage-class: "aws-efs"
        spec:
          accessModes: [ "ReadWriteOnce" ]
          resources:
            requests:
              storage: 1Gi
</code></pre>

<p>I have StorageClass configured as well. What am I doing wrong here?</p>

<p>Just a typo. </p>

<pre><code>volumeMounts:
  - name: postgredb
</code></pre>

<p>It should be <code>name:postgresdb</code>, not <code>name:postgredb</code>.</p>
