I got PersistentVolume in version "v1" cannot be handled as a PersistentVolume
error on k8s when I create a local persistent volume.
The output is:
Error from server (BadRequest): error when creating "setLocalPv.yaml":
PersistentVolume in version "v1" cannot be handled as a PersistentVolume:
v1.PersistentVolume.Spec: v1.PersistentVolumeSpec.PersistentVolumeSource:
Local: Capacity: unmarshalerDecoder: quantities must match the regular
expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)#x27;, error found in #10 byte of
...|ilesystem"},"local":|..., bigger context ...|acity":
{"storage":"10Gi","volumeMode":"Filesystem"},"local":{"path":"/k8sNodeData"},"nodeAffinity":
{|...
My yaml files are here.
setStorageClassSSD.yaml:
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-ssd-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
setLocalPv.yaml:<br>
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: dataStorage
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-ssd-storage
local:
path: /k8sNodeData
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: disktype
operator: In
values:
- ssd
---
I'd like to know where to fix it.
Looks like issue with format. Can you move volumeMode: Filesystem
to capacity
level.
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce