使用 Kubeflow Volumes

Kubeflow 中的 Volumes 作为 Kubernetes Persistent Volume Claims (PVCs) 进行管理。它们为您的数据、工作区和模型提供持久化存储,且不依赖于 Notebook servers 或其他工作负载的生命周期。

创建 Volume

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

管理 Volumes

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

在 Notebooks 中使用 Volume

要在 Notebook Server 中使用 volume:

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

使用 Kubeflow KServe Endpoints

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

访问 Endpoints UI

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

部署新模型

  1. New Endpoint: 单击 New Endpoint

  2. InferenceService 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

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