Closed manics closed 1 month ago
Example:
$ env | sort | grep -E _'(SERVICE|PORT)_'
JUPYTERHUB_SERVICE_PREFIX=/user/binder-examples-conda-sn3ftxwl/
JUPYTERHUB_SERVICE_URL=http://0.0.0.0:8888/user/binder-examples-conda-sn3ftxwl/
KUBERNETES_PORT_443_TCP_ADDR=172.20.0.1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://172.20.0.1:443
KUBERNETES_SERVICE_HOST=172.20.0.1
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443
Though I've belatedly realised this can also be set with extra_pod_config
. Do you reckon it's worth adding anyway, perhaps as a breaking change where it defaults to False? I can't think of good reason for needing this to be enabled for Jupyter applications.
There's definitely code that relies on the existence of these env vars to 'discover' other services I think. As this could be set with extra_pod_config, IMO we should just let this be.
Closing, as I think we should just let this be. Let me know if you disagree, @manics!
By default K8s injects environment variables for every service in the K8s cluster: https://kubernetes.io/docs/tutorials/services/connect-applications-service/#accessing-the-service This is meant to provide a backwards compatible way of accessing K8s services where in-cluster DNS is not available.
E.g. on mybinder.org:
JUPYTERHUB_SERVICE_PREFIX
andJUPYTERHUB_SERVICE_URL
are set by JupyterHub and are unaffected.KUBERNETES_SERVICE_*
andKUBERNETES_PORT_*
are always set regardless ofenableServiceLinks