在Argo UI配置日志链接

Argo UI支持在工作流(Workflow)和每个工作流Pod的用户界面(UI)中嵌入指向日志服务SLS的链接,以实现日志的快速访问。

适用范围

已开通日志服务。

操作步骤

  1. 登录ACK One控制台,在左侧导航栏选择工作流集群> > 配置管理

  2. 单击workflow controller配置(YAML)

  3. 替换下方模板中的clusterid为集群ID,region为集群所在地域(例如:cn-hangzhou),然后在编辑workflow controller配置页面,填入YAML文件中data部分:

    • ${metadata.namespace}: 当前工作流 / Pod / 事件源(Event Source) / 传感器(Sensor)所在的 Kubernetes 命名空间。

    • ${metadata.name}: 当前工作流 / Pod / 事件源 / 传感器的名称。

    • ${status.startedAt}: 工作流 / Pod 的开始时间戳,格式为 2021-01-01T10:35:56Z${status.finishedAt}: 工作流 / Pod 的结束时间戳,格式为 2021-01-01T10:35:56Z

      如果工作流或 Pod 仍在运行,该变量的值将为 null
      links: |
        # Adds a button to the workflow page. E.g. linking to you logging facility.
        - name: Workflow Logs
          scope: workflow
          url: https://sls.console.aliyun.com/lognext/project/k8s-log-{clusterid}/logsearch/workflow-controller-{clusterid}?slsRegion={region}&queryTimeType=3&queryString=${metadata.name}
        # Adds a button next to the pod.  E.g. linking to you logging facility but for the pod only.
        - name: Pod Logs
          scope: pod
          url: https://sls.console.aliyun.com/lognext/project/k8s-log-{clusterid}/logsearch/workflow-logstore?slsRegion={region}&queryTimeType=3&queryString=_pod_name_=${metadata.name} and _namespace_=${metadata.namespace}

    image

  4. 在工作流集群中重启Argo Server,使配置生效。

    kubectl rollout restart deployment/argo-server -n {clusterid}
  5. 登录Argo UI查看,UI中已添加日志服务链接。

    image