(可选) 在云 K8s 集群中使用 Jupyter Operator#

在本地 DGX BasePOD 部署指南中,可以有选择地配置 cm-jupyter-setup 并将其集成到 K8s 中。相同的服务(从头节点运行)也可用于为公共云 K8s 集群提供 Jupyter 访问。

  1. 验证 cm-jupyterhub 已设置并正确运行。

    service cm-jupyterhub status
    
  2. 配置用户并提供对相应 K8s 集群的访问权限。

    cmsh -c "user; add userone; set password useronepwd; commit"
    
  3. 当通过 Jupyter 使用 K8s 时,必须使用以下命令在 K8s 中单独添加用户。用户必须有权访问两个 K8s 集群中的 Jupyter kernel operator,才能使用 kernel 模板。

    1apt install cm-python39
    2cm-kubernetes-setup --add-user userone –-cluster aws-cloud --operators cm-jupyter-kernel-operator
    3cm-kubernetes-setup --add-user userone --cluster onprem --operators cm-jupyter-kernel-operator
    
  4. 使用配置了 Jupyter kernel operator 权限的帐户登录到 Jupyter Web 界面。

    _images/jupyter-operator-01.png
  5. 导航到 Bright 选项卡,在 Kubernetes Operator kernel 模板上选择 Python+NGC,然后选择“确定”。

    _images/jupyter-operator-02.png
  6. 在出现的“新建 kernel”窗口中填写必填字段,然后选择“创建”。

    _images/jupyter-operator-03.png

    在本示例中,公共云 K8s 部署是目标,方法是将集群名称 (aws-cloud) 作为路径扩展添加到 K8s 环境模块,并指定容器可以使用单个 GPU。

  7. Notebook 部分中选择 Kubernetes 上的 Python+NGC

    _images/jupyter-operator-04.png
  8. 一旦 operator 的状态变为“空闲”,运行 nvidia-smi 以确认 notebook 正在 T4 GPU 实例上运行。

    _images/jupyter-operator-05.png