<p>I want to create multiple pv with random name instead of giving a static name .Below is my sample yaml to create the pv . Insted of &quot;test-pv&quot; need to create the name as test-pv-some_id or only with some random numbers.</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: test-pv
spec:
  capacity:
    storage: 4Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  storageClassName: csi-nfs-sc
  persistentVolumeReclaimPolicy: Delete
</code></pre>

SARATH CHANDRAN
<p>I got the answer for the question . instead of metadata name &quot;generateName &quot; will help to create random pv names</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  generateName: test-pv-
</code></pre>
<p>This will provide an out put like test-pv-fdhhe or test-pv-hhte  some random names at the end.
Note that kubectl apply wont work with generateName , should use kubectl create .</p>
