<p>I am trying to create a persistent volume on my kubernetes cluster running on an Amazon AWS EC2 instance (Ubuntu 18.04).  I'm getting an error from kubectl when trying to create it. </p>

<p>I've tried looking up the error but I'm not getting any satisfactory search results. </p>

<p>Here is the pv.yaml file that I'm using. </p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv001
  labels:
    type: local
spec:
  capacity:
    storage: 1Gi
    storageClassName: manual
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  hostPath:
    path: /home/ubuntu/data/pv001
</code></pre>

<p>Here's the error that I am getting:</p>

<pre><code>Error from server (BadRequest): error when creating "./mysql-pv.yaml": 

PersistentVolume in version "v1" cannot be handled as a 
PersistentVolume: v1.PersistentVolume.Spec: 
v1.PersistentVolumeSpec.PersistentVolumeSource: HostPath: Capacity: 
unmarshalerDecoder: quantities must match the regular expression 
'^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte
of ...|":"manual"},"hostPat|..., bigger context ...|city":
{"storage":"1Gi","storageClassName":"manual"},"hostPath":
{"path":"/home/ubuntu/data/pv001"},"p|...

</code></pre>

<p>I cannot figure out from the message what the actual error is. </p>

<p>Any help appreciated.</p>

redmage123
<p>remove the storage class from pv definition. storage class is needed for dynamic provisioning of pv's.</p>

<p>in your case, you are using host path volumes. it should work without storage class.</p>

<p>If you are on k8s 1.14 then look at local volumes. refer the below link
<a href="https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/" rel="nofollow noreferrer">https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/</a></p>
