使用 Kubeflow 卷

Kubeflow 中的卷作为 Kubernetes Persistent Volume Claims (PVCs) 进行管理。它们为你的数据、工作区和模型提供持久化存储,与 Notebook 服务器或其他工作负载的生命周期无关。

创建卷

  1. 访问监控面板: 在 Kubeflow 中央监控面板侧边栏中点击 Volumes
  2. 新建卷: 点击 New Volume
  3. 配置
    • Name:输入卷的唯一名称。
    • Storage Class:如果有多个可用选项,选择 Storage Class(例如 topolvmnfs)。
    • Size:以 Gi 为单位指定卷大小(例如 10)。
    • Access Mode
      • ReadWriteOnce (RWO):由单个节点挂载(常用于块存储)。
      • ReadWriteMany (RWX):可由多个节点挂载(常用于 NFS/文件存储)。
  4. 创建: 点击 Create。卷成功创建后,其状态将变为 Bound

管理卷

  • 打开 PVC 查看器:点击卷旁边的“Folder”图标,创建一个临时 Pod 来挂载该卷并打开文件浏览器。这样你就可以直接查看、上传或下载卷中的文件。完成后点击“Close”以删除临时 Pod。
  • 删除:点击卷旁边的删除图标(垃圾桶)将其移除。注意:这会永久删除数据。
  • 筛选:使用搜索栏按名称、状态或 Storage Class 筛选卷。

在 Notebook 中使用卷

要在 Notebook Server 中使用卷:

  1. 创建 New Notebook 时,创建一个标准的 Workspace Volume(挂载到 /home/jovyan),或者...
  2. 滚动到 Data Volumes 以附加其他现有卷。
  3. 点击 Attach Existing Volume 并选择你的卷。
  4. 指定 Mount Path(例如 /home/jovyan/data)。

使用 Kubeflow KServe Endpoints

KServe Endpoints UI 允许你直接从 Kubeflow 监控面板部署、管理和监控机器学习模型的推理服务。

访问 Endpoints UI

  1. 在中央监控面板侧边栏中点击 KServe Endpoints
  2. 在页面顶部选择你的 namespace。
  3. 你将看到已部署的 InferenceService 列表,以及它们的状态和 URL。

部署新模型

  1. New Endpoint: 点击 New Endpoint

  2. InferneceService YAML

    • 提供你的 InferenceService 的 YAML 定义。你可以使用下面的示例 YAML 作为模板。
  3. Deploy: 点击 Create

    apiVersion: serving.kserve.io/v1beta1
    kind: InferenceService
    metadata:
      name: my-model
      namespace: my-namespace
    spec:
      predictor:
        model:
          modelFormat:
            name: "transformers"
          runtime: aml-vllm-0.9.2-cuda-12.6
          storageUri: "hf://model-repo/model-name"

监控和测试

部署完成后,等待状态变为 Ready

  • Inspect:点击模型名称以查看 YAML 详情和日志。
  • Get URL:复制提供的 endpoint URL(例如,http://model-name.namespace.svc.cluster.local/v1/models/model-name:predict 或外部 URL)。
  • Test:使用 curl 或 Python 客户端发送预测请求。