Cod*_*ewb 5 kubernetes kubernetes-helm rook-storage kubernetes-rook
我正在尝试在现有存储类名称之上/基于现有存储类名称创建一个持久卷。然后我想把 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
---
## Create Claim (links user to PV)
## ==> If pod is created, need to automatically create PVC for user (without their input)
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: sftp-pv-claim
spec:
storageClassName: sftp-pv-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
Run Code Online (Sandbox Code Playgroud)
The PersistentVolume "sftp-pv-storage" is invalid: spec: Requiredvalue: must specify a volume type.
\n\n在 PV 清单中,您必须提供卷类型。此处描述了所有受支持类型的列表。\n当您使用时,Ceph我假设您会使用 CephFS.
\n\n\ncephfs 卷允许将现有的 CephFS 卷挂载到您的 Pod 中。与emptyDir 不同,emptyDir 在删除 Pod 时会被删除,而 cephfs 卷的内容会被保留,并且该卷只是被卸载。这意味着 CephFS 卷可以预先填充数据,并且该数据可以在 Pod 之间交换。CephFS 可以由多个写入器同时挂载。
\n
的例子CephFS您可以在Github中找到。
如果我将“hostPath:路径:“/mnt/data””作为规范添加到 PV,它将显示为可用 PV(具有本地节点路径),但我的 PVC 未绑定到它。
\n\n如果您查看Kubernetes 官方文档storageClassName.
\n\n\n声明可以通过使用属性 storageClassName 指定 StorageClass 的名称来请求特定的类。只有所请求类的 PV(与 PVC 具有相同 storageClassName 的 PV)才能绑定到 PVC。
\n
storageClassName你的PV和PVC是不同的。
光伏:
\n\nspec:\n storageClassName: rook-ceph-block\nRun Code Online (Sandbox Code Playgroud)\n\nPVC:
\n\nspec:\n storageClassName: sftp-pv-storage\nRun Code Online (Sandbox Code Playgroud)\n\n希望它会有所帮助。
\n| 归档时间: |
|
| 查看次数: |
6367 次 |
| 最近记录: |