Configure the Kubeflow Notebook creation page

In Charmed Kubeflow, users create Kubeflow Notebooks from the Notebooks page on the Kubeflow Dashboard. Administrators can customize the options available to users, such as the suggested Notebook images or GPU configurations. This guide shows how to make these customizationsin Charmed Kubeflow.

Caution:

These are advanced configurations. Charmed Kubeflow does some validation for these inputs, but it is up to the user to provide valid input, especially with respect to Kubernetes YAML for tolerations and affinities.

Contents

Modifying the suggested Notebook images

The Notebook creation page includes dropdown lists of suggested container images for Notebook servers.

image_selection_dropdown

These are grouped into Jupyterlab, Visual Studio Code, and RStudio images. By default these lists include standard images built by Canonical or the Kubeflow project, but administrators can modify these lists to suit their organization through the jupyter-images, vscode-images, and rstudio-images configurations for the jupyter-ui charm.

View the list of images

View the current lists of images using juju config:

# view the list of images for Jupyter Notebooks
juju config jupyter-ui jupyter-images

# view the list for VSCode
juju config jupyter-ui vscode-images

# view the list for RStudio
juju config jupyter-ui rstudio-images

Configure the list of images

The jupyter-images, vscode-images, and rstudio-images configurations are yaml lists of image urls. It is typically easiest to specify them by writing a YAML file and then loading it into Juju.

For example using some jupyter-images, first define a file images.yaml file with the format:

- kubeflownotebookswg/jupyter-pytorch-full:v1.7.0
- kubeflownotebookswg/jupyter-tensorflow-full:v1.7.0
- swr.cn-south-1.myhuaweicloud.com/mindspore/jupyter-mindspore:v1.6.1

Note that these image urls must be available from where your Notebook Servers will deploy, otherwise they will be unable to start.

Then pass this configuration to Juju by running:

juju config jupyter-ui jupyter-images=@images.yaml

vscode-images and rstudio-images can be configured using the same method.

Modify the existing list of images

Setting juju config always sets the entire configuration value, rather than add or subtract from it. When you want to modify an existing configuration (for example, to add a new notebook image), it is convenient to export the current config to a file, edit the file, and import it back into Juju:

juju config jupyter-ui jupyter-images > images_v1.yaml

# edit images_v1.yaml, save as images_v2.yaml

juju config jupyter-ui jupyter-images=@images_v2.yaml

GPU Configurations

Note:

New in Charmed Kubeflow 1.9

Kubeflow Notebooks can use any GPU resources available in the Kubernetes cluster. The type and number of GPU resources can be chosen through dropdown options configured by administrators and chosen by users.

Charmed Kubeflow exposes this configuration to administrators through the following configurations:

  • gpu-vendors: The GPU vendors that are selectable by users in the New Notebook UI when creating a Notebook. Input is in JSON/YAML with keys (see the upstream configuration file for more details):
    • limitsKey: the key that corresponds to the GPU vendor resource in Kubernetes
    • uiName: the name to be shown in the UI for this GPU
  • gpu-vendors-default: The GPU vendor that is selected by default in the New Notebook UI when creating a Notebook. This must be one of the limitsKey values from the gpu-vendors config. Leave as an empty string to select no GPU vendor by default.
  • gpu-number-default: The number of GPUs that are selected by default in the New Notebook UI when creating a Notebook

Users see these in the dropdown menus:

To change these settings (for example to add an intel.com/gpu resource and set the default Notebook to use 2 NVIDIA gpus) use the same methods as discussed above for Notebook images:

# Set the list of available GPU resources
juju config jupyter-ui gpu-vendors='[{"limitsKey": "intel.com/gpu", "uiName": "Intel"}, {"limitsKey": "nvidia.com/gpu", "uiName": "NVIDIA"}, {"limitsKey": "amd.com/gpu", "uiName": "AMD"}]'

# Set the default Notebook to use 2 NVIDIA GPUs
juju config jupyter-ui gpu-number-default 2
# This must match a "limitsKey" from the gpu-vendors config
juju config jupyter-ui gpu-vendors-default nvidia.com/gpu

Node Affinities

Note:

New in Charmed Kubeflow 1.9

Kubeflow Notebooks can be configured to use Node Affinities when scheduling the Notebook in the cluster. This could be used to assign Notebooks to a specific type of node, avoid scheduling more than one Notebook on a given node, etc. These configurations are defined by administrators and can be chosen from dropdown lists by users.

Charmed Kubeflow exposes this configuration to administrators through the following configurations:

  • affinity-options: The Affinity configurations that are selectable by users in the New Notebook UI when creating a Notebook. Input is in JSON/YAML with keys (see the upstream configuration file for more details):
    • configKey: an arbitrary key for the configuration
    • displayName: the name shown in the Notebook UI
    • affinity: the affinity configuration, as defined by Kubernetes YAML
  • affinity-options-default: The configKey of the affinity to be chosen by default. Leave as an empty string to select no affinity by default

Users see these options from the dropdown menu:

affinity_config_dropdowns

To change these settings (for example, if your cluster has east and west availability zones defined by node labels and you want your users to be able to choose them) use the same methods as discussed above for Notebook images:

Create affinity_config.yaml:

- configKey: "az_us-east1"
  displayName: "Availability Zone us-east1"
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: topology.kubernetes.io/zone
            operator: In
            values:
            - us-east1
- configKey: "az_us-west1"
  displayName: "Availability Zone us-west1"
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: topology.kubernetes.io/zone
            operator: In
            values:
            - us-west1

Set the configuration, where the west AZ is chosen by default:

juju config jupyter-ui affinity-options=@affinity_config.yaml
# This must match a "configKey" from the affinity-options config
juju config jupyter-ui affinity-options-default="az_us-west1"

Pod Tolerations

Note:

New in Charmed Kubeflow 1.9

Kubeflow Notebooks can be configured to use Tolerations when scheduling the Notebook in the cluster. This could be used to allow a Notebook to schedule to a note with a specific taint, for example a node that has a GPU or some other special resource. These configurations are defined by administrators and can be chosen from dropdown lists by users.

Charmed Kubeflow exposes this configuration to administrators through the following configurations:

  • tolerations-options: The Affinity configurations that are selectable by users in the New Notebook UI when creating a Notebook. Input is in JSON/YAML with keys (see the upstream configuration file for more details):
    • groupKey: an arbitrary key for the configuration
    • displayName: the name shown in the Notebook UI
    • tolerations: the toleration configuration, as defined by Kubernetes YAML
  • tolerations-options-default: The groupKey of the affinity to be chosen by default. Leave as an empty string to select no toleration by default

Users see these options from the dropdown menu:

tolerations_dropdowns

To change these settings (for example, if your cluster has tolerations for nodes of a specific configuration) use the same methods as discussed above for Notebook images:

Create tolerations_config.yaml:

- groupKey: "group_1"
  displayName: "4 CPU 8Gb Mem at ~$0.50 USD per day"
  tolerations:
    - key: "dedicated"
      operator: "Equal"
      value: "kubeflow-c5.xlarge"
      effect: "NoSchedule"
- groupKey: "group_2"
  displayName: "8 CPU 16Gb Mem at ~$1.2 USD per day"
  tolerations:
    - key: "dedicated"
      operator: "Equal"
      value: "kubeflow-c5.xxlarge"
      effect: "NoSchedule"

Set the configuration, where we leave tolerations-options-default unset so no toleration is chosen by default:

juju config jupyter-ui tolerations-options=@tolerations_config.yaml
# tolerations-options-default is, by default, an empty string which means
# no toleration is selected by default.  We set it here explicitly to be
# clear in the example, but this is unnecessary.
juju config jupyter-ui tolerations-options-default=""

Configurations (PodDefaults)

Note:

New in Charmed Kubeflow 1.9

For cases where common data or configuration needs to be injected to many Notebooks, Kubeflow provides PodDefaults. PodDefaults are a namespaced custom resource that define configuration to be overlaid on a Pod. Each user has access to only the PodDefaults defined in their own Namespace. Users can create their own PodDefaults, and administrators can provide PodDefaults to users by adding them to the user’s namespaces.

Kubeflow Notebooks can be configured to use PodDefaults through the notebook creation screen. This could be used, for example, to automatically inject credentials for an MLflow or S3 store. These configurations can be chosen by the user during Notebook creation.

To define the default PodDefaults selected on the Notebook creation page, Charmed Kubeflow exposes the following configuration for administrators:

  • default-poddefaults: The PodDefaults that are selected for the user by default in the New Notebook UI when creating a Notebook. Input is a JSON/YAML list of names of PodDefaults (see the upstream configuration file for more details):

Users see these selections dropdown menu:

poddefaults_dropdown

To change this setting use the same methods as discussed above for Notebook images or set it directly using:

juju config jupyter-ui default-poddefaults='["add-s3-credentials", "add-mlflow-credentials"]'

Last updated 8 days ago.