<p>I followed the instructions in this post:
<a href="https://stackoverflow.com/questions/47378592/how-to-bound-a-persistent-volume-claim-with-a-gcepersistentdisk">how to bound a Persistent volume claim with a gcePersistentDisk?</a></p>

<p>And when I applied that, my PVC did not bind to the PV, instead I got this error in the event list:</p>

<pre><code>14s         17s          2         test-pvc.155b8df6bac15b5b   PersistentVolumeClaim               Warning   ProvisioningFailed   persistentvolume-controller   Failed to provision volume with StorageClass "standard": claim.Spec.Selector is not supported for dynamic provisioning on GCE
</code></pre>

<p>I found a github posting that suggested something that would fix this:</p>

<p><a href="https://github.com/coreos/prometheus-operator/issues/323#issuecomment-299016953" rel="nofollow noreferrer">https://github.com/coreos/prometheus-operator/issues/323#issuecomment-299016953</a></p>

<p>But unfortunately that made no difference.</p>

<p>Is there a soup-to-nuts doc somewhere telling us exactly how to use PV and PVC to create truly persistent volumes? Specifically where you can shut down the pv and pvc and restore them later, and get all your content back? Because as it seems right now, if you lose your PVC for whatever reason, you lose connection to your volume and there is no way to get it back again.</p>

Colin Fox
<p>The default <a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer"><code>StorageClass</code></a> is not compatible with a <code>gcePesistentDisk</code>.  Something like this would work:</p>

<pre><code>$ cat &lt;&lt;EOF | kubectl create -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: slow
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  replication-type: none
EOF
</code></pre>

<p>then on your PVC:</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nfs-pvc
  labels:
    app: test
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: "slow" &lt;== specify the storageClass
  resources:
    requests:
      storage: 2Gi
  selector:
    matchLabels:
      app: test
</code></pre>

<p>You can also set <em>"slow"</em> as the <a href="https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/" rel="nofollow noreferrer">default</a> <code>storageClass</code> in which case you wouldn't have to specify it on your PVC:</p>

<pre><code>$ kubectl patch storageclass slow -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
</code></pre>
