Argo Workflows 1
1. 部署Argo Workflows
https://github.com/argoproj/argo-workflows/releases
kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.5.7/install.yaml
工作流控制器负责运行工作流:
kubectl -n argo get deploy workflow-controller
Argo Server 提供了一个用户界面和 API:
kubectl -n argo get deploy argo-server
等待部署完成
kubectl -n argo wait deploy --all --for condition=Available --timeout 2m
2. 创建模板
示例
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: hello
spec:
serviceAccountName: argo # this is the service account that the workflow will run with
entrypoint: main # the first template to run in the workflows
templates:
- name: main
container: # this is a container template
image: docker/whalesay # this image prints "hello world" to the console
command: ["cowsay"]
创建工作流:
kubectl -n argo apply -f hello-workflow.yaml
3. 修改配置
将身份验证模式切换到服务器,以便我们暂时可以绕过 UI 登录
默认情况下,Argo Server 通过 https 运行。这与 Killercoda 不兼容,因此我们将同时禁用 https。我们不建议在生产安装中使用此功能。
kubectl patch deployment \
argo-server \
--namespace argo \
--type='json' \
-p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": [
"server",
"--auth-mode=server",
"--secure=false"
]},
{"op": "replace", "path": "/spec/template/spec/containers/0/readinessProbe/httpGet/scheme", "value": "HTTP"}
]'
等待 Argo Server 重新部署:
kubectl -n argo rollout status --watch --timeout=600s deployment/argo-server
转发端口以便访问界面
kubectl -n argo port-forward --address 0.0.0.0 svc/argo-server 2746:2746 > /dev/null &
4.使用Workflows
点击“提交新工作流程”:
单击“使用完整工作流选项进行编辑”
将下面yaml进行粘贴
metadata:
generateName: hello-world-
namespace: argo
spec:
serviceAccountName: argo
entrypoint: main
templates:
- name: main
container:
image: docker/whalesay
command: ["cowsay"]
点击“创建”。将看到工作流的图表。黄色图标表示处于挂起状态,几秒钟后它将变为蓝色表示它正在运行,最后变为绿色表示它已成功完成:
License:
杭州小单纯