Skip to content

fix(jupyterhub): use cluster DNS for internal Hub API calls#6

Open
idirze wants to merge 1 commit into
OKDP:mainfrom
idirze:proxy
Open

fix(jupyterhub): use cluster DNS for internal Hub API calls#6
idirze wants to merge 1 commit into
OKDP:mainfrom
idirze:proxy

Conversation

@idirze
Copy link
Copy Markdown
Contributor

@idirze idirze commented Jun 2, 2026

Description

Configure JupyterHub to use the Kubernetes fully qualified service DNS name for internal Hub communication via hub_connect_url.

This ensures spawned notebook pods receive a JUPYTERHUB_API_URL that uses the .svc.cluster.local DNS suffix, for example:

hub:
  config:
    JupyterHub:
      hub_connect_url: "http://jupyterhub-hub.<namespace>.svc.cluster.local:8081"

This allows internal Kubernetes service traffic to be excluded from the corporate proxy using a generic NO_PROXY / no_proxy suffix:

singleuser:
  extraEnv:
    NO_PROXY: "localhost,127.0.0.1,.svc,.svc.cluster.local,.cluster.local"
    no_proxy: "localhost,127.0.0.1,.svc,.svc.cluster.local,.cluster.local"

Without this, notebook pods may try to reach the internal Hub API through the corporate proxy and receive 403 Access Denied by proxy.

Related Issue

OKDP/trino-opal-example-policy#2

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / chore
  • Breaking change

How to Test

After deploying the chart change, restart the Hub and the affected notebook server.

Verify that a new single-user notebook pod receives the Kubernetes FQDN-based Hub API URL:

kubectl exec -n <namespace> -it <singleuser-pod> -- python -c 'import os; print(os.environ.get("JUPYTERHUB_API_URL"))'

Expected output:

http://jupyterhub-hub.<namespace>.svc.cluster.local:8081/hub/api

Verify that Requests does not select the corporate proxy for the Hub API URL:

kubectl exec -n <namespace> -it <singleuser-pod> -- python - <<'PY'
import os
import requests

url = os.environ["JUPYTERHUB_API_URL"]
print("JUPYTERHUB_API_URL =", url)
print("NO_PROXY =", os.environ.get("NO_PROXY") or os.environ.get("no_proxy"))
print("Selected proxies =", requests.utils.get_environ_proxies(url))
PY

Expected output:

Selected proxies = {}

Finally, verify that the notebook can call the Hub API without receiving a corporate proxy 403 response.

@idirze idirze requested review from SteBaum and abir-oumghar June 2, 2026 13:41
@PaulFarault PaulFarault self-requested a review June 3, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant