Help deploying jupyterlab-git extension with jupyterlab under kubernetes

Posting here also on advice from the google group for Project Jupyter.

Does anyone have experience or info about how the jupyterlab-git extension can be deployed for jupyterlab running under kubernetes, e.g. deployed using All I see at seems related to deploying the extension on your developer workstation. I would like to e.g. configure jupyterhub to include the jupyterlab-git extension through the z2jh helm chart used to deploy jupyterlab.

For Acumos (a LF Deep Learning community project) we are working to deploy jupyterlab as part of the Acumos platform, and are looking at deploying a local git server also as a backend service for storage and version control. Any input/pointers to how we can integrated such a git server with jupyterlab single-user containers via the jupyterlab-git extension, or where more info can be found, would be very appreciated.

Installing extensions is usually done by picking or building a custom image.

The only different step for installation is that the extension should be enabled at a higher level, by adding the --sys-prefix arg:

jupyter serverextension enable --py jupyterlab_git --sys-prefix

As for running a git server, authentication is probably going to be the trickiest step. Most private git servers I’m aware of use a standard ssh server so that git’s really just managing files on disk and ssh is responsible for authentication, permissions, etc. But this might be tricky for getting credentials (ssh keys) to user environments. You might consider deploying the GitLab helm chart, if you are already using kubernetes+helm. I haven’t done this, so I can’t speak to whether it’s a good choice (it does a lot more than just be a git server). The git on a server docs might also be useful for making a decision on how to go.

Thanks for the advice. I will look into how to use the server extension that way, e.g. as used in

The authentication part is still being worked out. We are trying to tie the user auth directly to their profile on the Acumos platform, automatically. This might another reason that I need to use a custom image, if I can’t just use a secret for this somehow using kubespawner.

I was able to get it installed in a custom docker image after hunting around a bit. Thanks again for the help.
Here’s the dockerfile (I installed nbgitpuller also to see what it can do for me):

FROM jupyter/tensorflow-notebook
USER root

RUN apt update &&
apt install --yes git


RUN pip install nbgitpuller &&
jupyter serverextension enable --py nbgitpuller --sys-prefix &&
jupyter labextension install @jupyterlab/git &&
pip install jupyterlab-git &&
jupyter serverextension enable --py jupyterlab_git


WORKDIR /home/jovyan/work
CMD [“”, “jupyter”, “lab”,"–notebook-dir=/home/jovyan/work"]