6. Tasks - konsloiz/masters-thesis GitHub Wiki

1. Using a custom Jupyterhub image

singleuser:
  image:
    name: konsloiz/jupyter-kale
    tag: latest

2. Connection KALE -> KFP

  extraEnv:
    KF_PIPELINES_ENDPOINT: http://ml-pipeline-ui.kubeflow:80

3. Mounting Service account & Kube Config

Many functions/libraries (Kale UI, Kale Compile & Run, KServing etc) were searching for the namespace name by referring to the following path:

No such file or directory: '/var/run/secrets/kubernetes.io/serviceaccount/namespace'

But since the service account was not mounted, the namespace name could not be resolved so this was giving several errors: (UI errors, serving errors, etc)

Every JupyterHub single-user spawned notebook (+Kale) was not able to detect the namespace of the pod that was running in. The problem was that each time a notebook was generated, service ccount (Sercrets) was not mounted.

Jupyter can be configured via jupyterhub_config.py which is stored config for JupyterHub. There, there is a configuration for the KubeSpawner to spawn Jupyter single notebook pod and mount service account secret files from Kubernetes.

This is the configuration: config c.KubeSpawner.service_account = Unicode(None)

Configuring the jupyterhub_config.py file would mean an extra file attached to the Docker image. That is not very optimum. Thankfully, since we are using a Helm chart to deploy JupyterLab, the solution was to add an extra configuration to the config.yaml of the chart:

# Part of the config.yaml for the Helm chart
hub:
  extraConfig: 
    ipaddress: |
     import os
     c.KubeSpawner.service_account = "hub"

Now, secrets for the service account are mounted to each spawned single user Jupyternotebook and the problem is solved. (UI error is also solved)