<p>Hi i'm trying to create a persistent volume for my mongoDB on kubernetes on google cloud platform and i'm stuck in pending</p>
<p>Here you have my manifest :</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: account-mongo-depl
  labels:
    app: account-mongo
spec:
  replicas: 1
  serviceName: 'account-mongo'
  selector:
    matchLabels:
      app: account-mongo
  template:
    metadata:
      labels:
        app: account-mongo
    spec:
      volumes:
        - name: account-mongo-storage
          persistentVolumeClaim:
            claimName: account-db-bs-claim
      containers:
        - name: account-mongo
          image: mongo
          volumeMounts:
            - mountPath: '/data/db'
              name: account-mongo-storage
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: account-db-bs-claim
spec:
  storageClassName: do-block-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

---
apiVersion: v1
kind: Service
metadata:
  name: account-mongo-srv
spec:
  type: ClusterIP
  selector:
    app: account-mongo
  ports:
    - name: account-db
      protocol: TCP
      port: 27017
      targetPort: 27017
</code></pre>
<p><a href="https://i.stack.imgur.com/qaWNP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qaWNP.png" alt="enter image description here" /></a>
Here you have my list of pods
<a href="https://i.stack.imgur.com/De2Cy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/De2Cy.png" alt="enter image description here" /></a></p>
<p>My pods is stuck in pending until fail</p>

Zuxaw
<p>If you're on GKE, you should already have dynamic provisioning setup.</p>
<pre class="lang-yaml prettyprint-override"><code>  storageClassName: do-block-storage
  accessModes:
    - ReadWriteOnce
</code></pre>
<p>&quot;do-block-storage&quot;? Were you running on Digital Ocean previously? You should be able remove the <code>storageClassName</code> line and use the default provisioner Google provides.</p>
<p>For example, here's a snippet from one of my own statefulsets</p>
<pre class="lang-yaml prettyprint-override"><code>  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: [ &quot;ReadWriteOnce&quot; ]
      ## Specify storage class to use nfs (requires nfs provisioner. Leave unset for dynamic provisioning)
      #storageClassName: &quot;nfs&quot;
      resources:
        requests:
          storage: 10G
</code></pre>
<p>I do not specify a storage class here, so it uses the default one, which provisions as a persistent disk on GCP</p>
<pre><code>$ kubectl get storageclass
NAME                 PROVISIONER            RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
standard (default)   kubernetes.io/gce-pd   Delete          Immediate           false                  2y245d
</code></pre>
