Changing CWD in Jupyterhub

Hello!,

I am new to Jupyterhub/notebook and exploring different ways to setup ML pipelines internally for my user community at work. I have a k8s cluster where I using helm to install and setup Jupyterhub. I want to know if there is a way to map or point the /work directectory to the /home/{username}, where every user has their own persistent storage for the pod. Now I can change the CWD using python to /home/{username} from the default /home/jovyan. However, I still cannot save the work to /home/{username}. All the .py files end up in /home/jovyan and the user has to manually copy those files to their home directory to be persistent.
Is there any way to change the default /work that points to /home/jovyan to /home/{username} wherever the user logs in. I am using the jupyter/base-notebook image.

Thanks

Folks,

Any thoughts or suggestions to change the current working directory (/home/jovyan) to the user home directory (/home/tom) that is backed by a persistent volume so that when user “Tom” creates his files, they all land up in /home/tom.

Thanks

Hi Bikash!

This is what we have running, and it accomplishes what you are looking for. You should just need to make a few changes and then append it to your helm chart.

  storage:
    extraVolumeMounts:
    - mountPath: /class
      name: pv-class-qtr
    extraVolumes:
    - name: pv-class-qtr
      nfs:
        path: /class
        server: NFS--Server
    homeMountPath: /home/jovyan
    static:
      pvcName: nfs-class-qtr
      subPath: home/{username}
    type: static
  uid: 0

Thanks. This worked.