Hello Guys,
i am deploying jupyterhub with swarm spawner.
My Hub is running in manager node, and single user servier is running in worker node in other container. There is a connection error between my single user server and Hub API. The URL of Hub API is http://jupyterhub:8081. I used the host name of jupyterhub Service in docker-compose.py.
See following error:
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | [E 2024-03-05 09:15:42.676 JupyterHubSingleUser] Failed to connect to my Hub at http://jupyterhub:8081/hub/api (attempt 3/5). Is it running?
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | Traceback (most recent call last):
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | File “/opt/conda/lib/python3.11/site-packages/jupyterhub/singleuser/extension.py”, line 336, in check_hub_version
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | resp = await client.fetch(self.hub_auth.api_url)
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | ConnectionRefusedError: [Errno 111] Connection refused
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | [E 2024-03-05 09:15:50.686 JupyterHubSingleUser] Failed to connect to my Hub at
jupyter-yuqiang-2egu.1.5rp9gsxs59js@node1 | ConnectionRefusedError: [Errno 111] Connection refused
If the Single user server runs in container in manager node, I can successfully spawn the server without any problem. The error occurs only when i put Single user server in worker nodes.
My jupyterhub_config.py is like this:
c.JupyterHub.spawner_class = “dockerspawner.SwarmSpawner”
c.SwarmSpawner.image = ‘jupyter/base-notebook’
c.SwarmSpawner.use_internal_ip = True
c.SwarmSpawner.remove_containers = True
c.SwarmSpawner.debug = True
c.SwarmSpawner.network_name = os.environ[“DOCKER_NETWORK_NAME”]
c.SwarmSpawner.extra_host_config = { ‘network_mode’:os.environ[“DOCKER_NETWORK_NAME”] }
c.Spawner.extra_placement_spec = { “constraints”: [“node.role == worker”] }
c.JupyterHub.port = 80
c.JupyterHub.hub_connect_ip = ‘jupyterhub’
c.Spawner.start_timeout = 60 * 10