一、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 实例配置文件解析的更多相关文章

  1. Nginx安装部署以及配置文件解析

    Nginx 中的 Location 指令 是NginxHttpCoreModule中重要指令.Location 指令,是用来为匹配的 URI 进行配置,URI 即语法中的”/uri/”,可以是字符串或 ...

  2. Nginx安装与配置文件解析

    导读 Nginx是一款开放源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP/POP3代理服务,是一款自由的软件,同时也是运维工程师必会的一种服务器,下面我就简单的说一下Nginx服务器的 ...

  3. ZooKeeper介绍,安装,配置文件解析

    什么是ZooKeeper? ZooKeeper是用于维护配置信息,命名,提供分布式同步和提供组服务的集中式服务. 所有这些类型的服务都以分布式应用程序以某种形式或另一种形式使用.每次实施时,都有很多工 ...

  4. Nginx入门篇(二)之Nginx部署与配置文件解析

    一.Nginx编译安装 ()查看系统环境 [root@localhost tools]# cat /etc/redhat-release CentOS Linux release (Core) [ro ...

  5. Mycat 配置文件解析

    Mycat 配置文件解析 一.server.xml 二.schema.xml 2.1 schema.xml文件中配置的参数解释 2.1.1 DataHost 2.1.2 DataNode 2.1.3 ...

  6. MyBatis配置文件解析

    MyBatis配置文件解析(概要) 1.configuration:根元素 1.1 properties:定义配置外在化 1.2 settings:一些全局性的配置 1.3 typeAliases:为 ...

  7. Hadoop配置文件解析

    Hadoop源码解析 2 --- Hadoop配置文件解析 1 Hadoop Configuration简介    Hadoop没有使用java.util.Properties管理配置文件, 也没有使 ...

  8. MyBatis 源码分析 - 配置文件解析过程

    * 本文速览 由于本篇文章篇幅比较大,所以这里拿出一节对本文进行快速概括.本篇文章对 MyBatis 配置文件中常用配置的解析过程进行了较为详细的介绍和分析,包括但不限于settings,typeAl ...

  9. Linux平台下源码安装mysql多实例数据库

    Linux平台下源码安装mysql多实例数据库[root@linux-node1 ~]# netstat -tlunp | grep 330tcp6 0 0 :::3306 :::* LISTEN 6 ...

随机推荐

  1. 使用 DML语句,对 “锦图网” 数据进行操作,连接查询(内连接,左外连接,右外连接,全连接)

    查看本章节 查看作业目录 需求说明: 对 "锦图网" 数据进行操作: 统计每一种线路类型的线路数量.最高线路价格.最低线路价格和平均线路价格,要求按照线路数量和平均线路价格升序显示 ...

  2. Java网络编程Demo,使用TCP 实现简单群聊功能Groupchat,创建一个服务端,使多个客户端都能收到消息

    效果图: 开启服务端 客户端一 客户端二 客户端三 实现代码: 客户端类 import java.io.IOException; import java.net.ServerSocket; impor ...

  3. Docker_容器(container)使用(4)

    参数说明 -i: 交互式操作. -t: 终端. -d: 指定容器运行模式. --name:指定容器的NAMES字段名称,不指定则随机生成名称 --restart:容器启动策略.默认为no,常用为alw ...

  4. 怎样查看Jenkins的版本

    where to check jenkins version To identify your current version of Jenkins, you can do one of two th ...

  5. react中使用charles实现本地数据mock

    首先下载charles软件地址,更详细的使用方法都包含在操作文档里,包含汉化版补丁(下载后查看) 链接:https://pan.baidu.com/s/1Q5rMbcX0Wus7AwdGUWa-Wg ...

  6. 新增访客数量MR统计之MR数据输出到MySQL

    关注公众号:分享电脑学习回复"百度云盘" 可以免费获取所有学习文档的代码(不定期更新)云盘目录说明:tools目录是安装包res 目录是每一个课件对应的代码和资源等doc 目录是一 ...

  7. Git 的配置 config

    Git 的配置 config Git 的配置 config config 文件简述 config 文件位置 信息查询 修改 config 文件 编辑配置文件 增加指定配置项 删除指定配置项 自助餐   ...

  8. UVA 10815 Andy's First Dictionary (C++ STL map && set )

    原题链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  9. test_5 排序‘+’、‘-’

    题目是:有一组"+"和"-"符号,要求将"+"排到左边,"-"排到右边,写出具体的实现方法. 方法一: l=['-', ...

  10. 联盛德 HLK-W806 (十三): 运行FatFs读写FAT和exFat格式的SD卡/TF卡

    目录 联盛德 HLK-W806 (一): Ubuntu20.04下的开发环境配置, 编译和烧录说明 联盛德 HLK-W806 (二): Win10下的开发环境配置, 编译和烧录说明 联盛德 HLK-W ...