开启Workflow UI
Workflow提供了一套UI来展示目前工作流的状态,方便查看每个步骤的容器日志,下面为您介绍如何使用Ingress暴露UI访问端点。
前提条件
您已成功创建一个Kubernetes集群。具体操作,请参见创建Kubernetes托管版集群。
您已连接到Kubernetes集群的Master节点。具体操作,请参见获取集群KubeConfig并通过kubectl工具连接集群。
操作步骤
执行htpasswd命令生成auth文件,用于存放用户名密码。
执行命令:
htpasswd -c auth workflow
预期输出:
New password: <workflow> New password: Re-type new password: Adding password for user workflow
执行如下命令,创建Secret来在Kubernetes集群中存放此加密文件。
kubectl create secret generic workflow-basic-auth --from-file=auth -n argo
创建并复制内容到ingress yaml文件中,并执行
kubectl apply -f ingress.yaml
命令,创建workflow-ingress路由。apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: workflow-ingress namespace: argo annotations: # type of authentication nginx.ingress.kubernetes.io/auth-type: basic # name of the secret that contains the user/password definitions nginx.ingress.kubernetes.io/auth-secret: workflow-basic-auth # message to display with an appropriate context why the authentication is required nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - workflow' spec: rules: - host: workflow.<yourTestHost> http: paths: - path: / backend: service: name: argo-ui port: number: 80 pathType: ImplementationSpecific
说明此处的
host
需要替换成您对应的集群地址,即您使用的域名,例如workflow.example.com。在浏览器输入workflow.<yourTestHost>,按照提示输入密码就能看到如下界面。
您可以根据需要查看工作流的状态。