Files
2026-03-29 09:08:01 +08:00

31 lines
1.3 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# docs/03-06-k3s-使用nfs存储.md — 按环境修改 server/path
apiVersion: v1 # PV/PVC 使用的核心 API 版本
kind: PersistentVolume # 资源类型:持久卷(集群级)
metadata: # PV 元信息
name: nfs-pv-demo # PV 名称
spec: # PV 规格
storageClassName: "" # 显式禁用默认 StorageClass供静态绑定 PVC 使用
capacity: # 容量声明
storage: 20Gi # PV 总容量
accessModes: # 访问模式列表
- ReadWriteMany # RWX多节点可读写
persistentVolumeReclaimPolicy: Retain # 回收策略:删除 PVC 后保留底层数据
nfs: # 存储后端NFS
server: <NFS_SERVER_IP> # NFS 服务器地址示例192.168.2.22;应用前必须替换)
path: <NFS_EXPORT_PATH> # NFS 导出目录(示例:/sdcard应用前必须替换
---
apiVersion: v1 # PVC 使用的核心 API 版本
kind: PersistentVolumeClaim # 资源类型:持久卷声明
metadata: # PVC 元信息
name: nfs-pvc-demo # PVC 名称
namespace: default # PVC 所在命名空间
spec: # PVC 规格
storageClassName: "" # 与 PV 对齐,避免被默认 longhorn class 注入导致绑定失败
accessModes: # 访问模式要求
- ReadWriteMany # 申请 RWX 访问模式
resources: # 资源请求
requests: # 配额请求
storage: 5Gi # 申请容量
volumeName: nfs-pv-demo # 显式绑定到指定 PV