存储资源配置

想添加分布式存储(NFS/CFS/COS/NAS/OSS/S3/GlusterFS/CephFS)、把它挂载成 PVC 并在项目组中启用时读这篇

平台使用 / 资源与存储
存储资源分布式存储storage挂载mountPVCPVnfscfscosnasosss3minioglusterfscephfs

存储资源

机器资源不同,存储资源是需要自己手动添加的。因为 CubeStudio 的分布式存储是用户自己提供的,所以用户需要自己配置分布式存储的信息。

输入图片说明

存储资源挂载绑定的“集群”是必填项(表单 clusters 字段 DataRequired)。添加好存储资源后,需要点击 “mount” 按钮挂载成 pvc 才可以使用,并且需要在项目组中添加相应的挂载配置(项目组 volume_mount 中以 存储名(storage):/路径 引用,见 项目空间)。

输入图片说明

输入图片说明

支持的存储类型(表单 storage_type 可选值,见 myapp/views/view_resource_storage.py:70):nfs(默认)、cfs(腾讯云)、cos(腾讯云)、nas(阿里云)、oss(阿里云)、s3(s3/minio)、glusterfscephfs自定义

mount 行为(见 myapp/models/model_storage.pyk8s_resource_listview_resource_storage.pymount action):会在 pipelineservicejupyterautoml 四个命名空间下分别创建 PV(名为 命名空间-存储名)和 PVC(名为 存储名),默认容量 10Gi、访问模式 ReadWriteMany、回收策略 Retain;带密钥的存储(cos/oss/s3/cephfs 等)会在 kube-system 命名空间下创建对应 Secret。卸载用 “umount” action。

存储底层(CSI 插件部署等)准备参见 02-部署安装 段。

cfs

腾讯云购买 cfs 存储。

在这里插入图片描述

自建 k8s 挂载,需要参考 https://github.com/TencentCloud/kubernetes-csi-tencentcloud 部署插件。

配置示例(yaml,对应表单默认值):

csi:
    driver: com.tencent.cloud.csi.cfs
    volumeAttributes:
      fsid: xx
      host: xx.xx.xx.xx    # 需要与k8s集群同一个区
      path: /xx/           # 需要确保目录存在

cos

腾讯云购买 cos 存储。

账号密钥参考:https://console.cloud.tencent.com/cam/capi

在这里插入图片描述

在这里插入图片描述

自建 k8s 挂载,需要参考 https://github.com/TencentCloud/kubernetes-csi-tencentcloud 部署插件。

配置示例(yaml,对应表单默认值;SecretId/SecretKey 会被抽取为 Secret):

csi:
  driver: com.tencent.cloud.csi.cosfs
  SecretId: xxxx       # https://console.cloud.tencent.com/cam/capi
  SecretKey: xxxx      # https://console.cloud.tencent.com/cam/capi
  volumeAttributes:
    url: http://cos.ap-xxx.myqcloud.com    # 需要在同一个子网下
    bucket: xxx
    path: /xx

nas

阿里云购买 nas 存储。

在这里插入图片描述

在这里插入图片描述

配置示例(yaml,对应表单默认值):

csi:
    driver: nasplugin.csi.alibabacloud.com
    volumeAttributes:
      path: /xx/xx           # 需要确保目录存在
      server: xx.cn-xx.nas.aliyuncs.com   # 需要在同一个子网下
      vers: '3'

oss

阿里云购买 oss 存储。

id 和密钥:

在这里插入图片描述

oss 地址:

在这里插入图片描述

配置:

在这里插入图片描述

配置示例(yaml,对应表单默认值;akId/akSecret 会被抽取为 Secret):

csi:
  driver: ossplugin.csi.alibabacloud.com
  akId: xxxx
  akSecret: xxxx
  volumeAttributes:
    url: your-oss-url.aliyuncs.com    # 需要在同一个子网下
    bucket: XXX-1251707795
    path: /osstest

s3

开放 kubeflow/minio 服务。

csi 方式

参考:https://github.com/yandex-cloud/k8s-csi-s3 部署 csi 驱动。

在这里插入图片描述

设置 minio 为外部存储:

在这里插入图片描述

配置示例(yaml,对应表单默认值;accessKeyID/secretAccessKey/endpoint/region 会被抽取为 Secret):

csi:
  driver: ru.yandex.s3.csi
  accessKeyID: xxxx
  secretAccessKey: xxxx
  endpoint: https://xx
  region: ""
  volumeAttributes:
    mounter: geesefs
    options: "--memory-limit 1000 --dir-mode 0777 --file-mode 0666"
    bucket: xx

另外一种方式

容器中安装插件:

sudo apt-get install -y fuse
# 或者
sudo yum install -y fuse

wget https://github.com/yandex-cloud/geesefs/releases/latest/download/geesefs-linux-amd64
chmod a+x geesefs-linux-amd64
sudo cp geesefs-linux-amd64 /usr/bin/geesefs

容器尝试挂载:

export AWS_ACCESS_KEY_ID=xxxxx
export AWS_SECRET_ACCESS_KEY=xxxxx
mkdir /test
geesefs --endpoint http://192.168.3.7:9000 test /test

glusterfs

容器部署 glusterfs 存储:

docker run -d --name gluster \
  -v /etc/glusterfs:/etc/glusterfs:z \
  -v /var/lib/glusterd:/var/lib/glusterd:z \
  -v /var/log/glusterfs:/var/log/glusterfs:z \
  -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
  -v /dev/:/dev --restart=always \
  -v /glusterfs/:/glusterfs \
  --privileged=true --net=host \
  gluster/gluster-centos

docker exec -it gluster bash
systemctl status glusterd
gluster peer probe 192.168.3.7   # ip为机器ip
# gluster volume create testvol localhost:/glusterfs/vol1 force
gluster volume create testvol transport tcp 192.168.3.7:/glusterfs/vol1 force

gluster volume start testvol
gluster volume info
echo "aa" >> /glusterfs/vol1/aa


# 主机客户端测试
apt -y install glusterfs-client
# 或者
yum install -y centos-release-gluster glusterfs glusterfs-fuse

mount -t glusterfs 192.168.3.7:/testvol /mnt
cat /mnt/aa

web 界面配置:

在这里插入图片描述

配置示例(yaml,对应表单默认值;平台会据此创建 Endpoints/Service 连到 gluster):

parameters:
    ip: xx.xx.xx,xx.xx.xx,xx.xx.xx
    port: 49152
    path: testvol  # gluster volume create NAME

cephfs

前提条件:创建 ceph 文件存储。

查看管理密钥:

root@node0:~# cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
    key = <密钥>
    caps mds = "allow *"
    caps mgr = "allow *"
    caps mon = "allow *"
    caps osd = "allow *"

如果 ceph 为单独文件存储机器,需要复制以下两个文件到 CubeStudio 管理节点:

scp cephserverip:/etc/ceph/ceph.conf /etc/ceph/
scp cephserverip:/etc/ceph/ceph.client.admin.keyring /etc/ceph/keyring

在这里插入图片描述

在配置处,将 ceph.client.admin.keyring 的用户名、key 填写在配置当中:

  • Monitors:监视器 cephserverip:6789
  • Path:ceph 文件存储路径
  • 集群:选择对应集群,集群中才会创建 ceph pv

配置示例(yaml,对应表单默认值;key 会被抽取为 Secret):

parameters:
    user: admin     # ceph认证用户
    key: 秘钥
    monitors: xx.xx.xx:6789,xx.xx.xx:6789,xx.xx.xx:6789 # ceph集群mon节点
    path: /

在这里插入图片描述

ceph 配置填写完毕,点击挂载:

在这里插入图片描述 在这里插入图片描述

点击 ceph 名称:

在这里插入图片描述

可以看到已经存在 xxxx-ceph 的 pv:

在这里插入图片描述

Public 项目分组下的集群为 dev(项目组与挂载配置见 项目空间):

在这里插入图片描述

修改项目分组下的挂载:

在这里插入图片描述

选择上方添加挂载的项目组:

在这里插入图片描述

等待 notebook 状态 running,点击名称进入 notebook:

在这里插入图片描述

df -h 可以看到已经添加 /ceph 的挂载。

最后更新 2026-07-04完整文档以官方仓库为准:GitHub Wiki