llm-wiki wiki · sources 2026-06-14

原文:raw/sig-storage-local-static-provisioner-architecture-analysis.md · 仓库:https://github.com/kubernetes-sigs/sig-storage-local-static-provisioner · 优先级 P1

一句话定位

Local Static Provisioner 发现节点本地磁盘/目录并创建 local PersistentVolume,配合调度绑定把数据固定到节点。

核心架构图

┌────────────────────────────────────────────────────────────────────────────┐
│ Local disk inventory                                                       │
│ Nodes expose disks or directories intended for local PersistentVolumes.    │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Local static provisioner DaemonSet                                         │
│ Discovers local paths and creates PVs with node affinity.                  │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Cleanup policy                                                             │
│ Handles released volumes, reuse behavior, and administrator-defined        │
│ discovery rules.                                                           │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Runtime boundary                                                           │
│ Scheduler binds Pods to the node that owns the selected local PV.          │
└────────────────────────────────────────────────────────────────────────────┘

模块分层

层 / 模块 职责
Discovery daemon scan mount directories
PV controller create/delete local PV
Node affinity bind PV to node
Cleanup scripts/classes Cleanup scripts/classes

关键数据流

节点挂载本地盘
        │
        ▼
daemon 发现可用路径
        │
        ▼
创建带 node affinity 的 PV
        │
        ▼
PVC 绑定后 Pod 调度到对应节点
        │
        ▼
释放后清理或保留

设计决策与哲学