我正在尝试在现有存储类名称之上/基于现有存储类名称创建一个持久卷。然后我想把 PVC 贴在上面;使他们受到约束。运行下面的代码,会给我我想要的“sftp-pv-claim”,但它不绑定到我的 PV(“sftp-pv-storage”)。它的状态是“待定”。
我收到的错误消息是:“PersistentVolume“sftp-pv-storage”无效:规范:必需值:必须指定卷类型”。如果有人能指出我为什么收到错误消息的正确方向,我将不胜感激。
眼镜:
我正在使用舵图创建 PV 和 PVC。
我正在使用 Rancher UI 来查看它们是否被绑定以及是否生成了 PV。
我使用的存储是带有 Rook 的 Ceph(允许动态配置 PV)。
错误:
我收到的错误消息是:“PersistentVolume“sftp-pv-storage”无效:规范:必需值:必须指定卷类型”。
尝试:
我试过使用 claimRef 和 matchLabels 无济于事。
我在我的 PV 规格中添加了“volumetype: none”。
如果我将 "hostPath: path: "/mnt/data"" 添加为 PV 的规范,它将显示为可用 PV(具有本地节点路径),但我的 PVC 未绑定到它。(此外,出于部署目的,我不想使用 hostPath。
## Create Persistent Storage for SFTP
## Ref: https://www.cloudtechnologyexperts.com/kubernetes-persistent-volume-with-rook/
kind: PersistentVolume
apiVersion: v1
metadata:
name: sftp-pv-storage
labels:
type: local
name: sftp-pv-storage
spec:
storageClassName: rook-ceph-block
capacity:
storage: 10Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
allowVolumeExpansion: true
volumetype: none
--- …Run Code Online (Sandbox Code Playgroud)