How to define eggress for singleuser to access outside world in Jupyterhub K8s

Hi everyone,

Anyone knows that how to define eggress policy for the singleuser to access outside the world ? I should install some package over the jupyterhub instance but it seems there is no connection to outside world. I think problem is related with network policy for the singleuser. But I need to know that how should define the egress for the accesing outside the world. When I try to install a package over the terminal in jupyterhub I got error like below.

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <>
Elapsed: -
jovyan@jupyter-jovyan:~$ conda install dask==2.30.0
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

Are you using Zero to JupyterHub with Kubernetes — Zero to JupyterHub with Kubernetes documentation ? The default configuration should allow external egress.

If it’s not working there may be a problem with your K8S cluster, or perhaps the physical network your cluster is running on has a restriction or firewall?

Hi @manics ! Yes, in the helm charts values.yaml, I just set cloudMetadata.blockWithIptables parameter with “false”. The reason of that when I login the hub and click the launch server button if cloudMetadata.blockWithIptables value is “true” jupyter-jovyan pod stuck in the error status. Also when I describe the pod I can not see any understandable message just see “backoff image …” . Now I checked the worker nodes network connection and I can access the network. But in the jupyter-jovyan pod still can not access the outside network. When I inspect the jupyter/jovyan container via docker commands, it is not attached any network. How can I fix it ? I try attach bridge network to running container but it throw an error.

Kubernetes and Docker are related but not the same, Kubernetes may handle networking independently of Docker.

You could try temporarily disabling Network Policies to see if that fixes your networking problems. If it doesn’t then you’ll have to debug your Kubernetes cluster.