在创建本地持久卷时,在k8s上出现PersistentVolume in version "v1" cannot be handled as a PersistentVolume
错误。
输出为:
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]*)$', error found in #10 byte of
...|ilesystem"},"local":|..., bigger context ...|acity":
{"storage":"10Gi","volumeMode":"Filesystem"},"local":{"path":"/k8sNodeData"},"nodeAffinity":
{|...
我的Yaml文件在这里。
setStorageClassSSD.yaml:
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-ssd-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
setLocalPv.yaml:
---
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
---
我想知道在哪里修复它。
答案 0 :(得分:3)
看起来像格式问题。您可以将volumeMode: Filesystem
移到capacity
级别吗?
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce