【问题标题】:How am I supposed to connect to a Dask-gateway deployed in Kubernetes from an outside service?我应该如何从外部服务连接到部署在 Kubernetes 中的 Dask 网关?
【发布时间】:2020-12-01 21:32:12
【问题描述】:

对于我应该如何连接到通过 Dask-helm 图表从外部服务创建的已部署 Dask 集群,我有点困惑。我按照here的说明部署了一个 Dask 集群@

成功部署后,它会显示我的 pod 和服务如下:

hub-574f85779c-sk7ct                                 1/1     Running   0          60m
jupyter-dask                                         1/1     Running   0          32m
proxy-68bcf94bd5-22kj5                               1/1     Running   0          60m
traefik-dhub-dask-gateway-6468d9cbff-9bclk           1/1     Running   0          60m
user-scheduler-c787cdb9f-924r2                       1/1     Running   0          60m
user-scheduler-c787cdb9f-l4jwv                       1/1     Running   0          60m

但请注意,我的服务将我的 traefic 显示为 ClusterIP,没有与之关联的公共 ip。

proxy-public                            LoadBalancer   10.3.245.29    104.zzz.yyy.xxx   80:30447/TCP                 66m
traefik-dhub-dask-gateway               ClusterIP      10.3.241.129   <none>            80/TCP                       66m

我能够连接到作为 Helm Chart 的一部分创建的提供的 Jupyter Notebook,使用类似于下面的代码并使用我的集群完全没有问题。

from dask_gateway import GatewayCluster
cluster = GatewayCluster()
client = cluster.get_client()
cluster.scale(2)
# then I can use this client to submit to the cluster
f = client.submit(inc, 7.2)

现在我想从运行在我的 k8s 集群之外的另一个应用程序进行连接。基于此documentation,我应该将addressauth 传递给Gateway,我一直在尝试以下方法:

import os
os.environ["JUPYTERHUB_API_TOKEN"] = "f206000844a60da8b48e40f6c91c3f2axxxxxxxxx"
from dask_gateway import Gateway
gateway = Gateway(
     "http://104.zzz.yyy.xxx/services/dask-gateway", 
    auth="jupyterhub"
)
gateway.list_clusters()

但总是以401 的形式返回,从外部连接到此集群的正确方法是什么?

此外,这些服务对公共互联网完全开放。保护这些的最佳实践是什么? (请不要告诉我使用 Kerberos :( )

ClientResponseError: 401, message='Unauthorized', url=URL('http://104.zzz.yyy.xxx/services/dask-gateway/api/v1/clusters/')

【问题讨论】:

  • 我也尝试过修改traefic 服务以公开为LoadBalancer,然后将其用作proxy_address="http://34.70.yyy.xxx",但得到相同的401 结果
  • 您是否尝试将网关地址设置为:"http://34.70.yyy.xxx", auth="jupyterhub" 而不是整个路径的结尾"http://104.zzz.yyy.xxx/services/dask-gateway", auth="jupyterhub"
  • @SaikatChakrabortty 是的,如果我不包括它,那么它会返回 404 ValueError: {"status": 404, "message": "Not Found"}。据我了解,Jupiter 在/services/dask-gateway 下将其公开为 k8s 服务
  • 您是否尝试使用此配置重新安装相同的设备? github.com/dask/dask-gateway/blob/master/resources/helm/… 在此处添加 API 令牌并安装可能是?参考:gateway.dask.org/…

标签: dask kubernetes-helm dask-distributed dask-kubernetes


【解决方案1】:

我在dask-gatewayGitHub 上发布了同样的问题作为问题,并得到了解决我问题的以下回复

https://github.com/dask/dask-gateway/issues/356#issuecomment-737504145

综上,使用this安装过程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 1970-01-01
    • 2019-01-06
    • 2019-09-04
    • 1970-01-01
    • 2019-03-26
    • 2023-04-10
    相关资源
    最近更新 更多