I’m trying to install JupyterHub on Kubernetes by following the helm installation.
I’m also trying to use the ingress to access JupyterHub by the sub-directry /jupyterhub . (The full base URL likes https://secure-ingress.com/jupyterhub/hub)
To meet this requirement, I changed values.yaml whose original version is downloaded from chart repository (chart version is 1.1.2).
Above commands did not output any errors and I could access to https://secure-ingress.com/jupyterhub/hub without errors.
However, JupyterHub stuck after the first admin login (only displays Your server is starting up.).
Is there any mistakes in my installation process of JupyterHub on Kubernetes Ingress?
$ kubectl logs -n jupyterhub jupyter-admin | tail -n 20
/home/jovyan/.jupyter/jupyter_notebook_config.json
[I 2021-08-11 23:04:21.627 SingleUserNotebookApp notebookapp:1593] Authentication of /metrics is OFF, since other authentication is disabled.
[W 2021-08-11 23:04:22.203 LabApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-11 23:04:22.203 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-11 23:04:22.203 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-11 23:04:22.203 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[D 2021-08-11 23:04:22.212 LabApp] Config changed: {'NotebookApp': {'open_browser': False, 'nbserver_extensions': <LazyConfigValue {'update': {'jupyterlab': True, 'nbgitpuller': True}}>}, 'ServerApp': {'ip': '0.0.0.0', 'port': 8888}, 'FileContentsManager': {'delete_to_trash': False}, 'SingleUserNotebookApp': {'ip': '0.0.0.0', 'port': 8888}, 'Application': {'log_level': 10}}
[I 2021-08-11 23:04:22.213 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab
[I 2021-08-11 23:04:22.213 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
Patching auth into jupyter_server.base.handlers.JupyterHandler(jupyter_server.base.handlers.AuthenticatedHandler) -> JupyterHandler(jupyterhub.singleuser.mixins.HubAuthenticatedHandler, jupyter_server.base.handlers.AuthenticatedHandler)
[I 2021-08-11 23:04:22.221 SingleUserNotebookApp mixins:576] Starting jupyterhub-singleuser server version 1.4.2
[D 2021-08-11 23:04:22.230 SingleUserNotebookApp _version:76] jupyterhub and jupyterhub-singleuser both on version 1.4.2
[I 2021-08-11 23:04:22.231 SingleUserNotebookApp notebookapp:2302] Serving notebooks from local directory: /home/jovyan
[I 2021-08-11 23:04:22.231 SingleUserNotebookApp notebookapp:2302] Jupyter Notebook 6.4.0 is running at:
[I 2021-08-11 23:04:22.231 SingleUserNotebookApp notebookapp:2302] http://jupyter-admin:8888/jupyterhub/user/admin/
[I 2021-08-11 23:04:22.231 SingleUserNotebookApp notebookapp:2303] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2021-08-11 23:04:22.245 SingleUserNotebookApp mixins:556] Updating Hub with activity every 300 seconds
[D 2021-08-11 23:04:22.246 SingleUserNotebookApp mixins:518] Notifying Hub of activity 2021-08-11T23:04:21.626437Z
[I 2021-08-11 23:04:22.488 SingleUserNotebookApp log:189] 302 GET /jupyterhub/user/admin/ -> /jupyterhub/user/admin/tree? (@10.233.117.50) 1.37ms
[D 2021-08-11 23:09:29.719 SingleUserNotebookApp mixins:518] Notifying Hub of activity 2021-08-11T23:04:21.626437Z
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:164] Searching ['/home/jovyan', '/home/jovyan/.jupyter', '/opt/conda/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:730] Looking for jupyter_config in /etc/jupyter
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:730] Looking for jupyter_config in /usr/local/etc/jupyter
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:730] Looking for jupyter_config in /opt/conda/etc/jupyter
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:730] Looking for jupyter_config in /home/jovyan/.jupyter
[D 2021-08-12 21:34:05.265 SingleUserNotebookApp application:730] Looking for jupyter_config in /home/jovyan
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:730] Looking for jupyter_notebook_config in /etc/jupyter
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:752] Loaded config file: /etc/jupyter/jupyter_notebook_config.py
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:730] Looking for jupyter_notebook_config in /usr/local/etc/jupyter
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:730] Looking for jupyter_notebook_config in /opt/conda/etc/jupyter
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:752] Loaded config file: /opt/conda/etc/jupyter/jupyter_notebook_config.json
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:730] Looking for jupyter_notebook_config in /home/jovyan/.jupyter
[D 2021-08-12 21:34:05.266 SingleUserNotebookApp application:730] Looking for jupyter_notebook_config in /home/jovyan
[W 2021-08-12 21:34:05.267 SingleUserNotebookApp configurable:190] Config option `open_browser` not recognized by `SingleUserNotebookApp`. Did you mean `browser`?
[D 2021-08-12 21:34:05.275 SingleUserNotebookApp config_manager:96] Paths used for configuration of jupyter_notebook_config:
/etc/jupyter/jupyter_notebook_config.json
[D 2021-08-12 21:34:05.275 SingleUserNotebookApp config_manager:96] Paths used for configuration of jupyter_notebook_config:
/usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2021-08-12 21:34:05.275 SingleUserNotebookApp config_manager:96] Paths used for configuration of jupyter_notebook_config:
/opt/conda/etc/jupyter/jupyter_notebook_config.d/jupyterlab.json
/opt/conda/etc/jupyter/jupyter_notebook_config.d/nbgitpuller.json
/opt/conda/etc/jupyter/jupyter_notebook_config.json
[D 2021-08-12 21:34:05.276 SingleUserNotebookApp config_manager:96] Paths used for configuration of jupyter_notebook_config:
/home/jovyan/.jupyter/jupyter_notebook_config.json
[I 2021-08-12 21:34:05.283 SingleUserNotebookApp notebookapp:1593] Authentication of /metrics is OFF, since other authentication is disabled.
[W 2021-08-12 21:34:05.875 LabApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-12 21:34:05.875 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-12 21:34:05.875 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2021-08-12 21:34:05.875 LabApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[D 2021-08-12 21:34:05.885 LabApp] Config changed: {'NotebookApp': {'open_browser': False, 'nbserver_extensions': <LazyConfigValue {'update': {'jupyterlab': True, 'nbgitpuller': True}}>}, 'ServerApp': {'ip': '0.0.0.0', 'port': 8888}, 'FileContentsManager': {'delete_to_trash': False}, 'SingleUserNotebookApp': {'ip': '0.0.0.0', 'port': 8888}, 'Application': {'log_level': 10}}
[I 2021-08-12 21:34:05.887 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab
[I 2021-08-12 21:34:05.887 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
Patching auth into jupyter_server.base.handlers.JupyterHandler(jupyter_server.base.handlers.AuthenticatedHandler) -> JupyterHandler(jupyterhub.singleuser.mixins.HubAuthenticatedHandler, jupyter_server.base.handlers.AuthenticatedHandler)
[I 2021-08-12 21:34:05.894 SingleUserNotebookApp mixins:576] Starting jupyterhub-singleuser server version 1.4.2
[D 2021-08-12 21:34:05.903 SingleUserNotebookApp _version:76] jupyterhub and jupyterhub-singleuser both on version 1.4.2
[I 2021-08-12 21:34:05.903 SingleUserNotebookApp notebookapp:2302] Serving notebooks from local directory: /home/jovyan
[I 2021-08-12 21:34:05.903 SingleUserNotebookApp notebookapp:2302] Jupyter Notebook 6.4.0 is running at:
[I 2021-08-12 21:34:05.903 SingleUserNotebookApp notebookapp:2302] http://jupyter-admin:8888/jupyterhub/user/admin/
[I 2021-08-12 21:34:05.903 SingleUserNotebookApp notebookapp:2303] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2021-08-12 21:34:05.912 SingleUserNotebookApp mixins:556] Updating Hub with activity every 300 seconds
[D 2021-08-12 21:34:05.913 SingleUserNotebookApp mixins:518] Notifying Hub of activity 2021-08-12T21:34:05.283354Z
[I 2021-08-12 21:34:10.227 SingleUserNotebookApp log:189] 302 GET /jupyterhub/user/admin/ -> /jupyterhub/user/admin/tree? (@10.233.117.56) 1.59ms
I also confirmed that JupyterHub works correctly when it runs without ingress on my environment.
So, I think ingress configuration of JupyterHub may cause this problem.
Also, the access to the API (such as /hub/api/users) results 403 (Forbidden) error.
This 403 error can be seen at progress bar from web browser’s developer tools.
I’m not sure if this is related or not.
Would you mind explaining how did you tested this?
Are you sure your ingress controller is correctly setup? Note this is not the same as the ingress- Z2JH creates an ingress specification, but it’s up to the ingress controller to implement it. Since you’re running your own cluster it’s possible your ingress controller requires additional configuration or annotations.
Yes, I have already tested my ingress controller by setting up kubernetes dashboard and accessing it without any issues.
I think the ingress controller setup correctly.
BTW, I used NGINX Ingress Controller now.
The configuration of values.yaml of the first post is correct?
Regarding this, I checked the log from hub pod.
There is 403 error.
I think the stuck after the first login comes from the failure of this API call.
But I’m not sure why this 403 error is raised when I accessed JupyterHub via the ingress controller.
[D 2021-08-16 23:34:09.398 JupyterHub user:317] Creating <class 'kubespawner.spawner.KubeSpawner'> for admin:
[I 2021-08-16 23:34:09.402 JupyterHub log:189] 302 GET /jupyterhub/hub/ -> /jupyterhub/hub/spawn (admin@10.233.119.0) 14.96ms
[D 2021-08-16 23:34:09.451 JupyterHub pages:217] Triggering spawn with default options for admin
[D 2021-08-16 23:34:09.451 JupyterHub base:880] Initiating spawn for admin
[D 2021-08-16 23:34:09.451 JupyterHub base:884] 0/64 concurrent spawns
[D 2021-08-16 23:34:09.451 JupyterHub base:889] 0 active servers
[I 2021-08-16 23:34:09.483 JupyterHub provider:574] Creating oauth client jupyterhub-user-admin
[D 2021-08-16 23:34:09.512 JupyterHub user:631] Calling Spawner.start for admin
[I 2021-08-16 23:34:09.514 JupyterHub spawner:2344] Attempting to create pvc claim-admin, with timeout 3
[I 2021-08-16 23:34:09.516 JupyterHub log:189] 302 GET /jupyterhub/hub/spawn -> /jupyterhub/hub/spawn-pending/admin (admin@10.233.119.0) 70.28ms
[I 2021-08-16 23:34:09.530 JupyterHub spawner:2361] PVC claim-admin already exists, so did not create new pvc.
[I 2021-08-16 23:34:09.536 JupyterHub spawner:2302] Attempting to create pod jupyter-admin, with timeout 3
[I 2021-08-16 23:34:09.637 JupyterHub pages:402] admin is pending spawn
[I 2021-08-16 23:34:09.638 JupyterHub log:189] 200 GET /jupyterhub/hub/spawn-pending/admin (admin@10.233.119.0) 11.91ms
[D 2021-08-16 23:34:09.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 0.97ms
[W 2021-08-16 23:34:09.865 JupyterHub base:57] Blocking Cross Origin API request. Referer: https://10.24.78.77:31340/jupyterhub/hub/spawn-pending/admin, Host: secure-ingress.com/jupyterhub/hub/
[W 2021-08-16 23:34:09.866 JupyterHub log:189] 403 GET /jupyterhub/hub/api/users/admin/server/progress (@10.233.119.0) 5.68ms
[D 2021-08-16 23:34:11.530 JupyterHub reflector:357] events watcher timeout
[D 2021-08-16 23:34:11.530 JupyterHub reflector:282] Connecting events watcher
[D 2021-08-16 23:34:11.532 JupyterHub reflector:357] pods watcher timeout
[D 2021-08-16 23:34:11.532 JupyterHub reflector:282] Connecting pods watcher
[D 2021-08-16 23:34:11.821 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.90ms
[D 2021-08-16 23:34:11.821 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.62ms
[I 2021-08-16 23:34:12.685 JupyterHub log:189] 200 GET /jupyterhub/hub/api (@10.233.99.75) 1.12ms
[D 2021-08-16 23:34:12.701 JupyterHub base:283] Recording first activity for <APIToken('b6fe...', user='admin')>
[D 2021-08-16 23:34:12.723 JupyterHub users:778] Activity for user admin: 2021-08-16T23:34:12.094719Z
[D 2021-08-16 23:34:12.724 JupyterHub users:796] Activity on server admin/: 2021-08-16T23:34:12.094719Z
[I 2021-08-16 23:34:12.734 JupyterHub log:189] 200 POST /jupyterhub/hub/api/users/admin/activity (admin@10.233.99.75) 38.25ms
[D 2021-08-16 23:34:13.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.02ms
[D 2021-08-16 23:34:14.628 JupyterHub spawner:2592] pod jupyterhub/jupyter-admin events before launch: 2021-08-16T23:34:09.553340Z [Normal] Successfully assigned jupyterhub/jupyter-admin to node-worker-01
2021-08-16T23:34:10Z [Normal] Container image "jupyterhub/k8s-network-tools:1.1.2" already present on machine
2021-08-16T23:34:10Z [Normal] Created container block-cloud-metadata
2021-08-16T23:34:10Z [Normal] Started container block-cloud-metadata
2021-08-16T23:34:11Z [Normal] Container image "jupyterhub/k8s-singleuser-sample:1.1.2" already present on machine
2021-08-16T23:34:11Z [Normal] Created container notebook
2021-08-16T23:34:11Z [Normal] Started container notebook
[D 2021-08-16 23:34:14.647 JupyterHub spawner:1179] Polling subprocess every 30s
[D 2021-08-16 23:34:14.654 JupyterHub utils:225] Server at http://10.233.99.75:8888/jupyterhub/user/admin/ responded with 302
[D 2021-08-16 23:34:14.654 JupyterHub _version:76] jupyterhub and jupyterhub-singleuser both on version 1.4.2
[I 2021-08-16 23:34:14.654 JupyterHub base:909] User admin took 5.203 seconds to start
[I 2021-08-16 23:34:14.654 JupyterHub proxy:285] Adding user admin to proxy /jupyterhub/user/admin/ => http://10.233.99.75:8888
[D 2021-08-16 23:34:14.654 JupyterHub proxy:832] Proxy: Fetching POST http://proxy-api:8001/api/routes/jupyterhub/user/admin
[D 2021-08-16 23:34:15.821 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.16ms
[D 2021-08-16 23:34:17.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.02ms
[D 2021-08-16 23:34:19.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.02ms
[D 2021-08-16 23:34:20.220 JupyterHub proxy:832] Proxy: Fetching GET http://proxy-api:8001/api/routes
[D 2021-08-16 23:34:20.225 JupyterHub proxy:905] Omitting non-jupyterhub route '/'
[I 2021-08-16 23:34:20.246 JupyterHub proxy:347] Checking routes
[D 2021-08-16 23:34:21.573 JupyterHub reflector:357] pods watcher timeout
[D 2021-08-16 23:34:21.574 JupyterHub reflector:282] Connecting pods watcher
[D 2021-08-16 23:34:21.576 JupyterHub reflector:357] events watcher timeout
[D 2021-08-16 23:34:21.576 JupyterHub reflector:282] Connecting events watcher
[D 2021-08-16 23:34:21.821 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.80ms
[D 2021-08-16 23:34:21.821 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.79ms
[D 2021-08-16 23:34:23.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.08ms
[D 2021-08-16 23:34:25.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.01ms
[D 2021-08-16 23:34:27.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.12ms
[D 2021-08-16 23:34:29.820 JupyterHub log:189] 200 GET /jupyterhub/hub/health (@10.24.78.74) 1.04ms
That error suggests there’s a mismatched host header somewhere. It might be worth looking at your nginx ingress logs to see if there’s anything informative in them?
It might be worth looking at your nginx ingress logs to see if there’s anything informative in them?
Yes. Your advice makes me solve the issue.
The main reason of this issue comes from the mismatch between host header and URL.
I changed host header by using browser plugin, and this made the mismatch between them.