<p>I'm trying to create a Persistent Volume on top of/based off of an existing Storage Class Name. Then I want to attach the PVC to it; so that they are bound. Running the code below, will give me the "sftp-pv-claim" I want, but it is not bound to my PV ("sftp-pv-storage"). It's status is "pending".</p>

<p>The error message I receive is: "The PersistentVolume "sftp-pv-storage" is invalid: spec: Required value: must specify a volume type".  If anyone can point me in the right direction as to why I'm getting the error message, it'd be much appreciated.</p>

<p><strong>Specs:</strong></p>

<p>I'm creating the PV and PVC using a helm chart.</p>

<p>I'm using the Rancher UI to see if they are bound or not and if the PV is generated.</p>

<p>The storage I'm using is Ceph with Rook (to allow for dynamic provisioning of PVs).</p>

<p><strong>Error:</strong></p>

<p>The error message I receive is: "The PersistentVolume "sftp-pv-storage" is invalid: spec: Required value: must specify a volume type".</p>

<p><strong>Attempts:</strong></p>

<p>I've tried using claimRef and matchLabels to no avail.</p>

<p>I've added "volumetype: none" to my PV specs.</p>

<p>If I add "hostPath: path: "/mnt/data"" as a spec to the PV, it will show up as an Available PV (with a local node path), but my PVC is not bonded to it. (Also, for deployment purposes I don't want to use hostPath.</p>

<pre><code>## Create Persistent Storage for SFTP
## Ref: https://www.cloudtechnologyexperts.com/kubernetes-persistent-volume-with-rook/

kind: PersistentVolume
apiVersion: v1
metadata:
  name: sftp-pv-storage
  labels:
    type: local
    name: sftp-pv-storage
spec:
  storageClassName: rook-ceph-block
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  allowVolumeExpansion: true
  volumetype: none

---
## Create Claim (links user to PV)
##  ==&gt; If pod is created, need to automatically create PVC for user (without their input)

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: sftp-pv-claim
spec:
  storageClassName: sftp-pv-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
</code></pre>

<p><strong>The PersistentVolume "sftp-pv-storage" is invalid: spec: Requiredvalue: must specify a volume type.</strong></p>

<p>In PV manifest you must provide type of volume. List of all supported types are described <a href="https://kubernetes.io/docs/concepts/storage/volumes/#types-of-volumes" rel="nofollow noreferrer">here</a>. 
As you are using <code>Ceph</code> I assume you will use  <code>CephFS</code>.</p>

<blockquote>
  <p>A cephfs volume allows an existing CephFS volume to be mounted into
  your Pod. Unlike emptyDir, which is erased when a Pod is removed, the
  contents of a cephfs volume are preserved and the volume is merely
  unmounted. This means that a CephFS volume can be pre-populated with
  data, and that data can be “handed off” between Pods. CephFS can be
  mounted by multiple writers simultaneously.</p>
</blockquote>

<p>Example of <code>CephFS</code> you can find in <a href="https://github.com/kubernetes/examples/tree/master/volumes/cephfs" rel="nofollow noreferrer">Github</a>.</p>

<p><strong>If I add "hostPath: path: "/mnt/data"" as a spec to the PV, it will show up as an Available PV (with a local node path), but my PVC is not bonded to it.</strong></p>

<p>If you will check <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1" rel="nofollow noreferrer">Official Kubernetes docs</a> about <code>storageClassName</code>.</p>

<blockquote>
  <p>A claim can request a particular class by specifying the name of a
  StorageClass using the attribute storageClassName. Only PVs of the
  requested class, ones with the same storageClassName as the PVC, can
  be bound to the PVC.</p>
</blockquote>

<p><code>storageClassName</code> of your <code>PV</code> and <code>PVC</code> are different.</p>

<p>PV:</p>

<pre><code>spec:
  storageClassName: rook-ceph-block
</code></pre>

<p>PVC:</p>

<pre><code>spec:
  storageClassName: sftp-pv-storage
</code></pre>

<p>Hope it will help.</p>
