Jupyterhub - Implementing with Contour Ingress Controller

We’ve just setup a new k8 cluster and our ingress controller is Contour.
I got vanilla jhub working just fine.
Now using the bitnami jupyter hub charts etc.

Now trying to integrate it with contour so we can have the /jhub etc.
Setting up httpproxy’s is just fine.

The issue is that when we try to set the base_url to jhub, the hub wont fully come up.

In the log I’m seeing
[I 2022-08-18 15:31:54.495 JupyterHub proxy:347] Checking routes
[I 2022-08-18 15:32:03.804 JupyterHub log:189] 302 GET /jhub/hub/health → /hub/jhub/hub/health (@172.20.6.1) 0.67ms
[W 2022-08-18 15:32:03.805 JupyterHub log:189] 404 GET /hub/jhub/hub/health (@172.20.6.1) 1.06ms

I dont understand…

  1. What does the I/W at start of line mean? Guessing its Info/Warning??
  2. What is this /jhub/hub/health → /hub/jhub/hub/health and why is it doing it?
    /jhub/hub/health exists
    /hub/jhub/hub/health doesnt… So why / what is it doing it and how do I stop it (what property etc in the chart is causing this and how can I prevent it)

Any help would be great (especially if someone has used Contour and/or Bitnami installation)

Yes, it’s Info/Warning

This redirect occurs because the Hub’s base URL is not /jhub/. Can you share how you are setting the base url and the startup logs from the hub pod (up to at least JupyterHub is now running at http...)?

So I am using the bitnami charts.

charts/bitnami/jupyterhub at master · bitnami/charts · GitHub

I did set the hub.baseUrl which should set the baseUrl property in the hub which results in “/jhub/hub/health” but then it tries to do “/hub/jhub/hub/health” .

I have raise this a chart issue with bitnami but I also trying to see if I could at least figure out where the issue might lie so I could figure it out myself.

If I run it from a native jhub install via helm it works just fine using the baseUrl property…

The bitnami hub log looks like.

[I 2022-08-22 14:26:20.026 JupyterHub app:2479] Running JupyterHub version 1.5.0
[I 2022-08-22 14:26:20.026 JupyterHub app:2510] Using Authenticator: jupyterhub.auth.DummyAuthenticator-1.5.0
[I 2022-08-22 14:26:20.026 JupyterHub app:2510] Using Spawner: kubespawner.spawner.KubeSpawner-1.1.0
[I 2022-08-22 14:26:20.026 JupyterHub app:2510] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-1.5.0
[I 2022-08-22 14:26:20.027 JupyterHub app:1599] Writing cookie_secret to /tmp/jupyterhub_cookie_secret
[I 2022-08-22 14:26:20.110 JupyterHub app:1859] Not using allowed_users. Any authenticated user will be allowed.
[I 2022-08-22 14:26:20.137 JupyterHub app:2549] Initialized 0 spawners in 0.002 seconds
[I 2022-08-22 14:26:20.139 JupyterHub app:2758] Not starting proxy
[I 2022-08-22 14:26:20.144 JupyterHub app:2794] Hub API listening on http://:8081/hub/

[I 2022-08-22 14:26:20.144 JupyterHub app:2796] Private Hub API connect url http://bjhub-jupyterhub-hub:8081/hub/
[I 2022-08-22 14:26:20.144 JupyterHub app:2809] Starting managed service cull-idle
[I 2022-08-22 14:26:20.144 JupyterHub service:339] Starting service ‘cull-idle’: [‘python3’, ‘-m’, ‘jupyterhub_idle_culler’, ‘–url=http://localhost:8081/hub/api’, ‘–timeout=3600’, ‘–cull-every=600’, ‘–concurrency=10’]

[I 2022-08-22 14:26:20.146 JupyterHub service:121] Spawning python3 -m jupyterhub_idle_culler --url=http://localhost:8081/hub/api --timeout=3600 --cull-every=600 --concurrency=10
[I 2022-08-22 14:26:20.153 JupyterHub proxy:347] Checking routes
[I 2022-08-22 14:26:20.153 JupyterHub app:2869] JupyterHub is now running at http://:8000
[I 2022-08-22 14:26:20.265 JupyterHub log:189] 200 GET /hub/api/users (cull-idle@::1) 18.81ms
[I 2022-08-22 14:26:37.592 JupyterHub log:189] 302 GET /jhub/hub/health → /hub/jhub/hub/health (@172.20.5.1) 1.86ms
[W 2022-08-22 14:26:37.622 JupyterHub log:189] 404 GET /hub/jhub/hub/health (@172.20.5.1) 28.57ms

sorry… for the extra posts… as it contains URLs for the log, i couldnt paste it in one go.

Fyi… This is the issue I raise with bitnami

This log shows that the base_url parameter is not being set (This logged URL is http://{hub_host}{base_url}hub/ so base_url is /). I’m not sure how the bitnami charts expose this option, or if they do, but it seems to be a question for the maintainers of those charts.

The config you want to set is c.JupyterHub.base_url = "...", but other parts of the chart likely need to be aware of this to work (health checks, etc.).

spot on!!
Turns out that in their values.yaml file, they build a configuration and then save it as a secret which the hub then reads.
The baseUrl was missing from it.
I’ve requested bitnami patch that file and it should work in the future.
Thanks for the insight…