404 page not found

I am trying to install jupyterhub using z2jh on top of k8s cluster. I want to have custom user environment with some default library installed. hub is able to spawn the user specific pod with customized docker image but proxy is unable to route the user to specific pod , on the browser it shows “404 page not found”. which is due to missing of frontend js and css files.


blockWithIptables: false
name: “<repo_name>/custom_ide”
tag: “1.34”
fsGid: 0
uid: 0
startTimeout: 600
homeMountPath: /home/file-store/jupyter/
cmd: null
defaultUrl: “/lab”
JUPYTERHUB_SINGLEUSER_APP: “jupyter_server.serverapp.ServerApp”
fsGroup: 0
runAsUser: 0
runAsGroup: 0


FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive

RUN pip install jupyter-server jupyter_client jupyterhub jupyterlab
RUN pip install feast==0.22.0 psycopg2-binary boto3 minio scikit-learn==1.1.3
RUN pip install protobuf==3.19 mlflow==1.27.0
RUN mkdir /home/file-store
&& mkdir /home/file-store/jupyter
&& mkdir /ssl
WORKDIR /home/file-store/jupyter
RUN apt-get install -y libpixman-1-dev libcairo2-dev openssl libgit2-dev

COPY . .

CMD [ “jupyter”,“lab”, “–ip=*”,“–allow-root”,“–PasswordIdentityProvider.hashed_password=‘’”,“–IdentityProvider.token=‘’”]

User pod logs:
[I 2023-09-25 13:09:36.564 ServerApp] Serving notebooks from local directory: /home/file-store/jupyter
[I 2023-09-25 13:09:36.564 ServerApp] Jupyter Server 2.7.3 is running at:
[I 2023-09-25 13:09:36.564 ServerApp] http://localhost:8888/lab
[I 2023-09-25 13:09:36.564 ServerApp]
[I 2023-09-25 13:09:36.564 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2023-09-25 13:09:36.587 ServerApp] No web browser found: Error(‘could not locate runnable browser’).
[I 2023-09-25 13:09:36.716 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2023-09-25 13:09:37.723 ServerApp] 302 GET /user// (@ 0.61ms
[I 2023-09-25 13:09:37.894 ServerApp] 302 GET /user// (@ 0.49ms
[W 2023-09-25 13:09:38.187 ServerApp] Clearing invalid/expired login cookie username-10-1-0-6-7000
[W 2023-09-25 13:09:38.198 ServerApp] 404 GET /user/ (52754ea674ee436eba220a41b610422a@ 11.80ms referer=http://<internal_ip>:7000/hub/spawn-pending/

As per my understanding, proxy routes the user to <external_address>/user/ to the <user_pod_Address> but my jupyterlab inside pod is running on the <user_pod_address>/lab not on <user_pod_Address>/ so it is unable to route. Can anyone help how I configure proxy to route to /lab endpoint or else how i can run my lab inside pod on /user/

I suppose you should spin a single user server using jupyterhub-singleuser executable and not jupyter lab. Check docker-stacks base image CMD directive.

Using start-singleuser.sh shows the dependency of start.sh file which does not exists in base-notebook image. can u help with what this file does & how can i use it in my custom image

Here is the start.sh script. But I would suggest you to use one of the single user images based on your JupyterHub version as the base image for your custom image so that all necessary files will be available.

1 Like

Actually the thing, I have my environment based python version 3.8 while I think docker singleuser image have by default python version 3.11.

Hve you tested your deployment with one of the standard docker-stacks images? That will help to rule out any other JupyterHub or K8s issues.

I have tried base-notebook, but by default it provide python 3.11. Can you help me with how can customize or use lower version of image so that I can have python 3.8 installed on it

If you want to use a different version of python, you need to use base-notebook docker image contents and build a image yourself. In the docker-stacks repo, you have all necessary files and Dockerfile available. Use them to build your own custom image.

Thanks… Have done it with same approach… Its works now