为 dask-jupyter helm chart 部署配置入口

configuring ingress for dask-jupyter helm chart deployment

我在 k8s 集群上部署了一个单用户 dask-jupyter helm chart (https://github.com/dask/helm-chart/tree/main/dask)。

$ 头盔 ls

NAME    NAMESPACE       REVISION    UPDATED                                 STATUS      CHART           APP VERSION
pangeo  wifire-quicfire 6           2021-11-22 15:29:38.809774 -0800 PST    deployed    dask-2021.11.2  2021.11.2  

$ kubectl get svc pangeo-dask-jupyter pangeo-dask-scheduler

NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
pangeo-dask-jupyter     ClusterIP   10.105.206.19   <none>        80/TCP            20h
pangeo-dask-scheduler   ClusterIP   10.107.121.88   <none>        8786/TCP,80/TCP   20h

我正在尝试公开一个外部 ip。我的 k8s 不允许使用 LoadBalancer 服务,所以我尝试启用入口。

为了暴露外部 ip,我尝试按照此模板启用入口: https://github.com/dask/helm-chart/blob/main/dask/templates/dask-jupyter-ingress.yaml

这是我的 values.yaml 的入口部分:

  ingress:
    enabled: true  
    tls:   
      - hosts: 
        - wifire-commons-pangeo-jupyter.nrp-nautilus.io
        secretName: dask-jupyter-tls
    hostname: wifire-commons-pangeo-jupyter.nrp-nautilus.io  # Ingress hostname.
    annotations:  
      kubernetes.io/ingress.class: haproxy

当我运行更新时,这是我的错误: $ helm upgrade pangeo -f values.yaml dask/dask

错误:升级失败:dask/templates/dask-jupyter-ingress.yaml 上的 YAML 解析错误:将 YAML 转换为 JSON 时出错:yaml:第 19 行:此上下文中不允许映射值

有人对为入口配置 YAML 有什么建议吗?

如果您仔细检查图表文档,您会发现您的 values.yaml 是不正确的。 要为您正在使用的图表启用入口,请在 values.yaml

中使用以下内容
dask:
  webUI:
    ingress:
      enabled: true
      tls: true
      secretName: dask-jupyter-tls
      hostname: wifire-commons-pangeo-jupyter.nrp-nautilus.io
      annotations:
        kubernetes.io/ingress.class: haproxy

这将生成正确的 Ingress 为:

# Source: ingresscontroller/charts/dask/templates/dask-scheduler-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dask-scheduler
  labels:
    app: dask-scheduler
    chart: "dask-4.5.7"
    release: "dask"
    heritage: "Helm"
  annotations:
    kubernetes.io/ingress.class: haproxy
spec:
  tls:
    - hosts:
      - "wifire-commons-pangeo-jupyter.nrp-nautilus.io"
      secretName: dask-jupyter-tls
  rules:
  - host: wifire-commons-pangeo-jupyter.nrp-nautilus.io
    http:
      paths:
      - backend:
          serviceName: dask-scheduler
          servicePort: 80