公开Argo的UI
默认情况下argo的UI服务是没对外网开放的,需要进行设置对外公布,有三种方法
方法一:kubectl port-forward
使用命令
kubectl -n argo port-forward deployment/argo-ui 8001:8001
1
则 在可以使用 链接访问: http://127.0.0.1:8001
方式二:kubectl proxy
使用命令
kubectl proxy
1
则使用如下链接可以访问:
http://127.0.0.1:8001/api/v1/namespaces/argo/services/argo-ui/proxy/
1
注意,组件下载和web控制台不支持使用这种方法
方法三:使用loadBalancer
把argo-ui service 设置成 loadBalancer类型的服务
使用命令
kubectl patch svc argo-ui -n argo -p '{"spec": {"type": "LoadBalancer"}}'
1
等待分配外网地址
使用命令查看如下:
kubectl get svc argo-ui -n argo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argo-ui LoadBalancer 10.19.255.205 35.197.49.167 8080:31768/TCP 1m
访问方式
35.197.49.167:8080
35.197.49.167对应EXTERNAL-IP
8080对应PORT(S)
还有一种是分配的域名
如果EXTERNAL-IP比较长会显示省略号如下:
zhangxiaofans-MacBook-Pro:report-api joe$ kubectl get svc argo-ui -n argo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argo-ui LoadBalancer 10.19.255.205 a4c2851a9b3fd... 80:31768/TCP 10m
解决方法使用describe
zhangxiaofans-MacBook-Pro:report-api joe$ kubectl describe svc argo-ui -n argo
Name: argo-ui
Namespace: argo
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"argo-ui","namespace":"argo"},"spec":{"ports":[{"port":80,"targetPort":8001}],"...
Selector: app=argo-ui
Type: LoadBalancer
IP: 10.19.255.205
LoadBalancer Ingress: a4c2851a9b3fd11efassadfdsads-35sdffsdgfsd.cn-northwest-1.elb.amazonaws.com.cn
Port: <unset> 80/TCP
TargetPort: 8001/TCP
NodePort: <unset> 31768/TCP
Endpoints: 10.19.255.205:8001
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Type 9m service-controller ClusterIP -> LoadBalancer
Normal EnsuringLoadBalancer 9m service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 9m service-controller Ensured load balancer
zhangxiaofans-MacBook-Pro:report-api joe$
如果输出中Port是80则不需要带端口,直接使用LoadBalancer Ingress访问即可:
a4c2851a9b3fd11efassadfdsads-35sdffsdgfsd.cn-northwest-1.elb.amazonaws.com.cn
1
注意,在Minikube集群中,不会自动获取到外网ip,会一直显示pending。 使用如下命令确定argo的ui链接:
minikube service -n argo --url argo-ui |