Changing CWD in Jupyterhub


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.



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.


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.

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

Thanks. This worked.