-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Use TLS in Dask-Gateway? #344
Comments
The There's a few ways we could enable configuring TLS for use with k8s. I'd probably mimic how JupyterHub exposes things:
The first two are the easiest to setup, just require some helm chart munging. |
Thanks Jim, This is very helpful information. I should clarify that I was going to set-up Dask Gateway as a service of JupyterHub because that simplifies a lot of things from an authentication perspective, but we also have AI Platform Notebooks which our users are used to, so using JupyterHub seems kind of redundant and would most likely confuse them. |
I've got a similar use case with Dask Gateway, k8s, and jupyterhub. My k8s is deployed on AWS EKS. I've set up Dask Gateway using a Jupyterhub api token for auth. My JupyterHub deployment uses tls and is behind a VPN. Everything with Dask Gateway deployed via the helm chart works great. However (re: this thread), I've found I can't figure out how to set up tls certificates for the Dask dashboard that is generated when clusters are deployed. Additionally, traffic to those dashboards ends up not being protected by the VPN. I can use the Ideally, I'd like to have both tls and use an internal IP so that I can still get Dask dashboards but they'll only be exposed to internal network traffic. One of two wouldn't be bad either. Is this possible by configuring, perhaps
Any thoughts or direction would be appreciated and I'd be happy to include more info. I'm not sure this warrants a new Issue, but if so, I'll open one. |
Easy fix: use annotations + cloud provider to provision an ELB for Dask Gateway's Traefik service, and in the annotations configure that ELB to terminate HTTPS. Granted, requests are unencrypted past the ELB, but the important stuff (client to scheduler comms) relies on mTLS and is encrypted end to end anyway. |
Also, all of the REST traffic can stay in cluster (instead of routing out through the ELB) if you leverage the K8s DNS names for the services. The dashboard will be the only exception (you'll need to pass the public-address keyword to the gateway object or the client will display a widget with the internal, inaccessible URL) but it will use https. |
Thanks @droctothorpe for the suggestions. I'll see if I can get the ELB to use HTTPS termination- looks pretty straightforward if these docs are enough. As for your second comment- would you mind clarifying? I'm not sure how to take advantage of k8s DNS names to ensure that the dashboard is the only service exposed. Right now, the only service with an External-IP is the dask-gateway traefik service, so that would lead me to think that all other traffic is already limited to internal paths. But if there is some further configuration that can ensure this, I'd definitely want to implement that. Any links, resources, or suggestions are always appreciated. |
The other services will be exposed (via the same ELB that serves the dashboard). The advantage of using the K8s DNS names is that requests from the in-cluster Dask Gateway clients to the Gateway API don't leave the cluster for no reason. It also helps with environment file consistency as well if you're provisioning to multiple discrete environments. It's a nice to have but not strictly necessary and kind of a tangent from your original question, heh. |
Thanks for the tips! I'm still pretty new to kubernetes and looking into the DNS names has been edifying. I wanted to post this snippet as reference for others. I was able to hide Dask Gateway, including the Dask Dashboards, behind my VPN using the following annotations on the traefik service. Note that these annotations are specific to AWS EKS with AWS Elastic Load Balancers (and AWS Load Balancer Controller as the Ingress Controller), but I'd think there are similar methods with other load balancers.
[edit- fixed indentations] |
I understand that it is recommended to use TLS in a production environment as per the docs, so I'm trying to set that up. Here are the steps I followed for my attempt at doing this:
[1] I added the paths to the self-signed certificate and key files in a Dockerfile
[2] Pushed that Docker Image to Google Cloud Image Repository
[3] Replace image names from "daskgateway/dask-gateway-server" to the image in Google Cloud Image Repo in the helm config file
[4] Added the paths to the self-signed key and cert files in the extraConfig field
What happened:
Nothing changed. No errors. The internal load balancer for the traefik proxy server still using HTTP.
What you expected to happen:
I expected the internal load balancer to use HTTPS
Minimal Complete Verifiable Example:
Dockerfile:
Helm Config:
Environment:
The text was updated successfully, but these errors were encountered: