Dask in k8s external client access

I’m trying to figure out how to give access to clients external to the kubernetes cluster. The client seems to allow a few options for accessing the scheduler. We use a load balancer in front of nginx ingress. This isn’t really meant for tcp. I am going to attempt to add tcp to nginx.

I am curious how others are handling this. I thought the gateway would help, but that seems more about having a way for users to create clusters in k8s.

You could use KubeCluster from the dask_kubernetes project. I believe that should work if you have Kubernetes credentials set up on the machine you’re running the Client from. See the Dask Kubernetes section here:

https://blog.dask.org/2020/07/23/current-state-of-distributed-dask-clusters

Dask Gateway can also help you here. My understanding here is that Gateway will abstract away Kubernetes and Kubernetes authentication from the end user running the Client. So they don’t have to worry about backend specifics, but my experience is limited here.

1 Like

The options that @matthiasdv mentions are great.

You can also use the websocket protocol instead of TCP which will happily be proxied via nginx.

1 Like

The problem for me is k8s on prem. There’s no service type of loadbalancer OOTB on prem. I think kubecluster works fine if you are running in a pod in the cluster already. If not, i am struggling to figure out how a local scheduler would connect to the workers.

I am trying to keep from managing nodeports.

The gateway seems good, but it looks like traefik needs the loadbalancer type for the svc.

Interesting. I’ll need to check out using WS. Didn’t notice that in the docs.

KubeCluster will use kubectl to forward ports automatically if you use a ClusterIP service type and you are outside the cluster. So as long as kubectl port-forward works for you then KubeCluster will work.

Also just for clarification the scheduler and workers all run in the cluster as pods, and the client connects to the scheduler. So either port forwards or websockets via an ingress are good approaches.

1 Like