我有以下pv.yaml
Kubernetes/Kustomization文件:
apiVersion: v1
kind: PersistentVolume
metadata:
name: myapp-common-pv
namespace: myapp
labels:
app.kubernetes.io/name: myapp-common-pv
app.kubernetes.io/component: common-pv
app.kubernetes.io/part-of: myapp
spec:
capacity:
storage: 30Gi
accessModes:
- ReadWriteMany
nfs:
path: /myapp_nfs_share
server: <omitted for security purposes>
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myapp-common-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: ""
volumeName: myapp-common-pv
resources:
requests:
storage: 30gi
当我运行这个时,我得到:
persistentvolume/myapp-common-pv unchanged
Error from server (BadRequest): error when creating "/Users/myuser/workspace/myapp/k8s/pv": PersistentVolumeClaim in version "v1" cannot be handled as a PersistentVolumeClaim: v1.PersistentVolumeClaim.Spec: v1.PersistentVolumeClaimSpec.StorageClassName: Resources: v1.ResourceRequirements.Requests: unmarshalerDecoder: quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte of ...|ge":"30gi"}},"storag|..., bigger context ...|teMany"],"resources":{"requests":{"storage":"30gi"}},"storageClassName":"","volumeName":"myapp-common|...
上面,<omitted for security purposes>
是一个有效的IP地址,我只是删除了它…安全目的。
我设置storageClassName: ""
是因为这篇文章解释了为什么它是必要的。
有人能发现我的pv.yaml
文件有什么问题吗?我需要做什么(特别是!)来修复它?
改变数量必须与正则表达式相匹配 '^([+-]?[ 0 - 9] +) ([eEinumkKMGTP][- +] ? [0 - 9])的美元,错误中发现# 10字节…| ge":"30 gi"}}
storage: 30gi
storage: 30Gi
Gi
部分必须遵循预定义的单元。