> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siflow.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# CKS 集群持久化存储概述

> 了解 PV、PVC 和 StorageClass 的关系，并选择动态存储卷或静态存储卷。

CKS 集群使用 Kubernetes 持久卷为工作负载保存数据。需要让训练数据、模型文件或任务输出在 Pod 重建后继续保留时，应先准备持久化存储，再通过 PVC 将存储挂载到工作负载。

## 了解持久化存储对象

| 对象 | 作用 | 作用域 |
| - | - | - |
| PV（PersistentVolume） | 表示可供集群使用的一份持久化存储。PV 包含容量、访问模式、回收策略和存储后端等信息。 | 集群级 |
| PVC（PersistentVolumeClaim） | 表示工作负载对存储容量和访问方式的申请。工作负载通过 PVC 使用 PV，不直接引用 PV。 | 命名空间级 |
| StorageClass | 定义动态创建存储卷的方式，包括存储插件、回收策略和存储参数。 | 集群级 |

PVC 与符合条件的 PV 绑定后，状态变为 `Bound`。工作负载只能引用同一命名空间下的 PVC。

## 选择存储卷使用方式

根据后端存储是否已经准备好，选择动态存储卷或静态存储卷。

| 方式 | 适用场景 | 资源关系 | 需要准备的内容 |
| - | - | - | - |
| 动态存储卷 | 希望按 PVC 申请自动创建 PV。 | StorageClass → PVC → 自动创建 PV | 可用的存储插件和 StorageClass。使用 GPFS 时，也可以通过卷模板创建 StorageClass。 |
| 静态存储卷 | 后端存储已经存在，或需要由存储管理员预先准备存储资源。 | 后端存储 → 手动创建 PV → PVC | 后端存储信息，以及与该存储匹配的 PV 配置。 |

StorageClass 是动态创建存储卷的核心对象。使用静态存储卷时，也可以通过 `storageClassName` 对 PV 和 PVC 进行匹配，但不会由 StorageClass 自动创建 PV。

## 使用持久化存储

1. 根据存储资源的准备方式，完成存储卷创建或绑定：

   * [使用动态存储卷](/gpu-cloud/cluster/use-dynamic-persistent-volume)
   * [使用静态存储卷](/gpu-cloud/cluster/use-static-persistent-volume)

2. 确认 PVC 状态为 `Bound`。

3. [为工作负载挂载持久化存储](/gpu-cloud/cluster/mount-persistent-storage-to-workload)。

4. 不再需要存储资源时，[清理持久化存储资源](/gpu-cloud/cluster/cleanup-persistent-storage-resources)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.