llm-wiki wiki · sources 2026-06-14

原文:raw/nfs-subdir-external-provisioner-architecture-analysis.md · 仓库:https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner · 优先级 P1

一句话定位

NFS Subdir External Provisioner 在远端 NFS server 上为 PVC 动态创建子目录,是轻量实验/中小集群常见 storage class。

核心架构图

┌────────────────────────────────────────────────────────────────────────────┐
│ PVC requests NFS-backed storage                                            │
│ A StorageClass points dynamic claims at a shared NFS export.               │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ NFS subdir provisioner                                                     │
│ Watches PVCs and creates one directory per claim under the configured      │
│ export.                                                                    │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ PV lifecycle                                                               │
│ Creates PersistentVolumes, binds claims, and handles reclaim behavior.     │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Runtime boundary                                                           │
│ Pods mount shared NFS-backed volumes through standard Kubernetes PV/PVC    │
│ objects.                                                                   │
└────────────────────────────────────────────────────────────────────────────┘

模块分层

层 / 模块 职责
Provisioner controller watch PVC/PV
NFS backend shared export path
StorageClass parameters StorageClass parameters
Cleanup/reclaim policy Cleanup/reclaim policy

关键数据流

用户创建 PVC
        │
        ▼
external provisioner 创建 NFS 子目录
        │
        ▼
生成 PV 指向该路径
        │
        ▼
Pod 挂载 PVC
        │
        ▼
删除时按 reclaim policy 清理

设计决策与哲学