Argo 安装和 workflow 实例配置文件解析
一、Argo 安装配置
1.1 Argo 安装
$ kubectl create ns argo
$ kubectl apply -n argo -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start-postgres.yaml
$ kubectl get all -n argo

1.2 修改 Argo 服务对外访问
$ kubectl edit svc argo-server -n argo
...
selector:
app: argo-server
sessionAffinity: None
type: NodePort # 修改为 NodePort
status:
...
保存退出跟 vim 操作一样,成功退出后等待即可。
1.3 Web 访问 Argo
[root@k8s-master01 ~]# kubectl get svc -n argo
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/argo-server NodePort 10.233.11.72 <none> 2746:31335/TCP 23h
...

1.4 Linux 安装 Argo CLI
$ curl -sLO https://github.com/argoproj/argo/releases/download/v3.0.2/argo-linux-amd64.gz
$ gunzip argo-linux-amd64.gz
$ chmod +x argo-linux-amd64
$ mv ./argo-linux-amd64 /usr/local/bin/argo
$ argo version
其他版本链接:https://github.com/argoproj/argo-workflows/releases
我安装 v3.2.8 版本时,在命令行创建 workflow 的时候,一直卡住不动,UI 界面也不同步 workflow,后面换一个低点版本就解决该问题了。
如果你也遇到我类似的问题,可以试着换个版本试试。
二、官方工作流实例
2.1 hello-world 实例
构建工作流
[root@k8s-master01 argo]# argo submit -n argo --watch https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/hello-world.yaml
hello-world.yaml配置文件解析
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world- # workflow 名字
labels: # 标签
workflows.argoproj.io/archive-strategy: "false"
annotations: # 为用户添加的额外注解
workflows.argoproj.io/description: |
This is a simple hello world example.
You can also run it in Python: https://couler-proj.github.io/couler/examples/#hello-world
spec:
entrypoint: whalesay # 表示第一个执行的模板名称,让工作流知道从哪个模板开始执行,类似于 main 函数
templates: # 以下是模板内容
- name: whalesay # 模板名称
container: # 容器内容
image: docker/whalesay:latest # 调用 docker/whalesay 镜像
command: [cowsay] # 调用 cowsay 命令
args: ["hello world"] # 执行内容
Pod 初始化

工作流完成

查看 Pod Logs
[root@k8s-master01 argo]# argo logs -n argo @latest
# @latest 查看最新工作流log

Argo UI 也可以同步查看 Pod 运行信息


2.2 Steps 类型的 workflow
接下来练习稍微复杂点的 Workflow,hello-hello-hello.yml配置文件解析
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: steps- # Workflow 的名称前缀
spec:
entrypoint: hello-hello-hello # 表示第一个执行的模板名称,让工作流知道从哪个模板开始执行,类似于 main 函数
# 该templates中有两个模板,分别是:hello-hello-hello和whalesay
templates:
- name: hello-hello-hello # 第一个模板 hello-hello-hello
steps: # template 的类型是 steps
# 一个 template 有多种类型,分别为:container、script、dag、steps、resource、suspend
- - name: hello1 # 在 steps 类型中,[--] 表示顺序执行,[-] 表示并行执行
template: whalesay # 引用 whalesay 模板
arguments:
parameters:
- name: message
value: "hello1"
- - name: hello2a # [--] 顺序执行
template: whalesay
arguments:
parameters:
- name: message
value: "hello2a"
- name: hello2b # [-] 表示跟上一步并行运行
template: whalesay
arguments:
parameters:
- name: message
value: "hello2b"
- name: whalesay # 第二个模板 whalesay
inputs: # input、output 实现数据交互
parameters:
- name: message
container:
image: docker/whalesay # 镜像名称
command: [cowsay] # 执行命令
args: ["{{inputs.parameters.message}}"] # 执行的 value
构建 workflow
[root@k8s-master01 argo]# ls
hello-hello-hello.yml hello-world.yaml
[root@k8s-master01 argo]# argo submit -n argo hello-hello-hello.yml --watch
# submit 创建工作流
# -n argo 存放的命名空间
# --watch 实时监听工作流

在 Argo Web 界面查看,此时工作流正在构建中

第一个 hello 已经执行完成,并打印相应的信息


第一个完成之后,接下来 hello2a 和 hello2b 会并行执行

hello2a 和 hello2b 都会打印相关信息,然后结束整个workflow

以上非常基础的 Argo Workflow 学习,连门都没入,希望能和大佬们交流交流。
Argo 安装和 workflow 实例配置文件解析的更多相关文章
- Nginx安装部署以及配置文件解析
Nginx 中的 Location 指令 是NginxHttpCoreModule中重要指令.Location 指令,是用来为匹配的 URI 进行配置,URI 即语法中的”/uri/”,可以是字符串或 ...
- Nginx安装与配置文件解析
导读 Nginx是一款开放源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP/POP3代理服务,是一款自由的软件,同时也是运维工程师必会的一种服务器,下面我就简单的说一下Nginx服务器的 ...
- ZooKeeper介绍,安装,配置文件解析
什么是ZooKeeper? ZooKeeper是用于维护配置信息,命名,提供分布式同步和提供组服务的集中式服务. 所有这些类型的服务都以分布式应用程序以某种形式或另一种形式使用.每次实施时,都有很多工 ...
- Nginx入门篇(二)之Nginx部署与配置文件解析
一.Nginx编译安装 ()查看系统环境 [root@localhost tools]# cat /etc/redhat-release CentOS Linux release (Core) [ro ...
- Mycat 配置文件解析
Mycat 配置文件解析 一.server.xml 二.schema.xml 2.1 schema.xml文件中配置的参数解释 2.1.1 DataHost 2.1.2 DataNode 2.1.3 ...
- MyBatis配置文件解析
MyBatis配置文件解析(概要) 1.configuration:根元素 1.1 properties:定义配置外在化 1.2 settings:一些全局性的配置 1.3 typeAliases:为 ...
- Hadoop配置文件解析
Hadoop源码解析 2 --- Hadoop配置文件解析 1 Hadoop Configuration简介 Hadoop没有使用java.util.Properties管理配置文件, 也没有使 ...
- MyBatis 源码分析 - 配置文件解析过程
* 本文速览 由于本篇文章篇幅比较大,所以这里拿出一节对本文进行快速概括.本篇文章对 MyBatis 配置文件中常用配置的解析过程进行了较为详细的介绍和分析,包括但不限于settings,typeAl ...
- Linux平台下源码安装mysql多实例数据库
Linux平台下源码安装mysql多实例数据库[root@linux-node1 ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6 ...
随机推荐
- 【入门到精通】❤️「Java工程师全栈知识路线」
持续更新中- Vue前端开发 章节 内容 实践练习 Vue.js高效前端开发 • (实践练习) 第1章 Vue.js高效前端开发 • [ 一.初识Vue.js ] 第2章 Vue.js高效前端开发 • ...
- Java基础寒假作业-简易计算器
需求: 使用Java编写计算器的控制台程序,完成简单的加减乘除运算.实现以下功能: 1.运算选择 请用户选择一个算法(1.加法 2.减法 3.乘法 4.除法 5.关闭计算器) 2.计算 a)加法:实现 ...
- 「影院售票系统」 · Java Swing + MySQL JDBC开发
目录 文档说明: 一.语言和环境 二.实现功能 三.数据库设计 四.具体要求及推荐实现步骤 五.注意事项 六.评分标准 实现代码: 一.数据库: 二.Java Swing: com.ynavc.Bea ...
- ProtoBuf3语法指南(Protocol Buffers)_下
0.说明 ProtoBuf3语法指南, 又称为proto3, 是谷歌的Protocol Buffers第3个版本. 本文基于官方英文版本翻译, 加上了自己的理解少量修改, 一共分为上下两部分. 1.A ...
- Django_测试板块(六)
本文初略的记录了Django测试板块相关信息,详情请阅官方文档:https://docs.djangoproject.com/zh-hans/3.1/topics/testing/ 开始写我们的第一个 ...
- div背景css样式笔记
<style type="text/css"> .div1 { width: 1024px; height: 100%; margin: 0 auto; /*backg ...
- SpringBoot学习笔记二之Spring整合Mybatis
原文链接: https://www.toutiao.com/i6803235766274097678/ 在learn-admin-component子工程中加入搭建环境所需要的具体依赖(因为比较长配置 ...
- 帮你克服web字体选择焦虑症
1.背景 前端时间产品经理问我,移动端web默认字体有哪些,哪些字体不侵权?我当时感觉这方面的知识很匮乏,只能回答出微软雅黑和苹方简体,平常写代码时,没怎么留意过font-family设置的字体属性, ...
- python驱动SAP完成数据导出(二)
在上一篇 python驱动SAP完成数据导出(一)中,我们提到了数据导出前,SAP布局的重要性,如何识别当前布局模式,以及如何切换到想要的布局.本篇小爬将着重讲讲数据导出的注意事项. 我们可以通过如下 ...
- Jekyll + NexT + GitHub Pages 主题深度优化
前言 笔者在用 Jekyll 搭建个人博客时踩了很多的坑,最后发现了一款不错的主题 jekyll-theme-next,但网上关于 Jekyll 版的 Next 主题优化教程少之又少,于是就决定自己写 ...