gpt4 book ai didi

kubernetes - 所需值 : must specify a volume type when statically provisioning PV

转载 作者:行者123 更新时间:2023-12-02 11:28:09 27 4
gpt4 key购买 nike

尝试使用 GCP SSD 存储静态配置 PV。错误并显示以下消息:

The PersistentVolume "monitoring" is invalid: spec: Required value: must specify a volume type

重现步骤:
$ cat storage.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ssd
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
reclaimPolicy: Retain


$ kubectl apply -f storage.yaml
storageclass.storage.k8s.io/ssd created


$ cat pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: monitoring
spec:
storageClassName: ssd
capacity:
storage: 50Gi
persistentVolumeReclaimPolicy: Retain
accessModes:
- ReadWriteOnce


$ kubectl apply -f pv.yaml
The PersistentVolume "monitoring" is invalid: spec: Required value: must specify a volume type

Kubernetes 版本:
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.6-gke.10", GitCommit:"aaf0906400b5fc1d858ce0566a571e4f3ed06b9f", GitTreeState:"clean", BuildDate:"2019-03-30T19:30:48Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}

最佳答案

如果使用供应商,您通常不会自己创建 PV。只需创建一个需要创建的存储类的 PVC,GKE 就会为您提供具有请求的存储大小和类型的 PV:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-retain-ssd-storage
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: ssd

关于kubernetes - 所需值 : must specify a volume type when statically provisioning PV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55955646/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com