<p>I'm trying to create a PersistentVolumeClaim giv it a specific volumeName to use.</p>

<p>I use this code:</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: zipkin  
  name: pvc-ciro
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: nfs-provisioner
  resources:
    requests:
      storage: 0.1Gi
  volumeName: "demo"      
</code></pre>

<p>If I remove volumeName the PVC is correctly bound otherways remain in pending status.</p>

<p>Why?</p>

ciro
<p>The <code>volumeName</code> is a name of the <code>PersistentVolume</code> you want to use.</p>

<p>On <a href="https://cloud.google.com/kubernetes-engine" rel="nofollow noreferrer">GKE</a> PVC can automatically create a PV that will bound to, or you can specify the name of it using <code>volumeName</code>.</p>

<p>pvc.yaml</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-ciro
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: standard
  resources:
    requests:
      storage: 0.1Gi
  volumeName: demo
</code></pre>

<p>pv.yaml</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: demo
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: standard
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    path: /tmp
    server: 172.17.0.2
</code></pre>

<p>And the output will be:</p>

<pre><code>$ kubectl get pv
NAME   CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM              STORAGECLASS   REASON   AGE
demo   5Gi        RWO            Recycle          Bound    default/pvc-ciro   standard                13s
$ kubectl get pvc
NAME       STATUS   VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
pvc-ciro   Bound    demo     5Gi        RWO            standard       8s
</code></pre>

<p>You can read more details in Kubernetes documentation regarding <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">Persistent Volumes</a>.</p>
