首页 > 其他分享 >argo-workflow

argo-workflow

时间:2022-11-08 23:58:33浏览次数:57  
标签:name workflow io argo world argoproj

Install Argo Workflows

Release v3.4.3 · argoproj/argo-workflows (github.com)

CLI

# Download the binary
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.4.3/argo-linux-amd64.gz

# Unzip
gunzip argo-linux-amd64.gz

# Make binary executable
chmod +x argo-linux-amd64

# Move binary to path
mv ./argo-linux-amd64 /usr/local/bin/argo

# Test installation
argo version

Controller and Server

kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.4.3/install.yaml

Patch argo-server authentication

kubectl patch deployment \
  argo-server \
  --namespace argo \
  --type='json' \
  -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": [
  "server",
  "--auth-mode=server"
]}]'

ingress for the UI

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: argo-ingress
  namespace: argo
  annotations:
    ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/backend-protocol: https # ingress-nginx
spec:
  defaultBackend:
    service:
      name: argo-server
      port:
        number: 2746
  rules:
    - host: argo-workflow.sdaas.com
      http:
        paths:
          - backend:
              service:
                name: argo-server
                port:
                  number: 2746
            path: /
            pathType: Prefix

Port-forward the UI

kubectl -n argo port-forward deployment/argo-server 2746:2746

This will serve the UI on https://localhost:2746. Due to the self-signed certificate, you will receive a TLS error which you will need to manually approve.

Submitting an example workflow

Submit an example workflow (CLI)

argo submit -n argo --watch https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/hello-world.yaml

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
  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
  templates:
  - name: whalesay
    container:
      image: docker/whalesay:latest
      command: [cowsay]
      args: ["hello world"]

You can list all the Workflows you have submitted by running the command below:

argo list -n argo
argo get -n argo @latest
argo logs -n argo @latest

Walk Through

Parameters

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-parameters-
spec:
  # invoke the whalesay template with
  # "hello world" as the argument
  # to the message parameter
  entrypoint: whalesay
  arguments:
    parameters:
    - name: message
      value: hello world

  templates:
  - name: whalesay
    inputs:
      parameters:
      - name: message       # parameter declaration
    container:
      # run cowsay with that message input parameter as args
      image: docker/whalesay
      command: [cowsay]
      args: ["{{inputs.parameters.message}}"]

argo submit -n argo --watch arguments-parameters.yaml -p message="goodbye world"

RBAC (需要调试)

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: argo-workflow
rules:
# pod get/watch is used to identify the container IDs of the current pod
# pod patch is used to annotate the step's outputs back to controller (e.g. artifact location)
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
  - watch
  - patch
  - list
  - create
# logs get/watch are used to get the pods logs for script outputs, and for log archival
- apiGroups:
  - ""
  resources:
  - pods/log
  verbs:
  - get
  - watch
  - list
  - create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: argo-default-workflow
  namespace: argo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: argo-workflow
subjects:
- kind: ServiceAccount
  name: argo
  namespace: default

标签:name,workflow,io,argo,world,argoproj
From: https://www.cnblogs.com/wl30564/p/16871716.html

相关文章

  • argoCD 部署及常用功能和原理
    argoCD应用官方参考链接:https://artifacthub.io/packages/helm/argo/argo-cdhttps://argo-cd.readthedocs.io/en/stable/k8s集群版本v1.23.5部署方式根据官方的的部......
  • SDK、API 等 IT Jargon 总结
    1.API:本质上一切别人写的代码或者代码库,从而给你用的都是API、当然你也可以写API2.SDK:软件开发工具包、其实和API这个词混用也没什么关系、主要体现在这个是给软件......
  • D365: Workflow避免同一审核人多次审批(问题处理2:审批人拒绝,重新提交后,审批流直接流转
    前面提到过,当审批人出现在多个节点,前面的节点审批完成后,后面节点如果再次出现同一审批人,系统自动审批,在测试中发现另外一种场景,当审批流执行了多个节点后,中间节点的某个审......
  • Workflow,要不要了解一下
    摘要:Workflow本质是开发者基于实际业务场景开发用于部署模型或应用的流水线工具。Workflow(也称工作流,下文中均可使用工作流进行描述)本质是开发者基于实际业务场景开发用于部......
  • 【 云原生 | kubernetes 】- Argo CD Gitlab身份验证及SSO单点登录
    :zap:前言:了解OAuth协议。OAuth是一种授权协议,它可以用来保证第三方只有当获得授权的时候,才能访问授权者的权限我们之前文章已经大概了解了ArgoCD的作用和一些用法。在......
  • C++ 实现argosort
    #include<bits/stdc++.h>usingnamespacestd;intmain(){intn=5,t;vector<int>a,b;for(inti=0;i<n;++i){scanf("%d",&t......
  • 【解决】CICD、GitHub actions workflow新建仓库push时报错could not read Username f
    git报错fatal:couldnotreadUsernamefor'https://github.com':Nosuchdeviceoraddress原因是没有GitHubtoken,而且cicd时无法输入用户密码正常来说我们使用act......
  • 云原生--argocd 自动同步
    自动同步在前面我们使用了手动同步https://www.cnblogs.com/zouzou-busy/p/16600104.html,当git仓库有变更时,需要手动点击SYNC,比较麻烦,我们也可以创建一个自动同步的应......
  • 云原生--argocd 命令行
    前戏在使用命令行的时候需要先登录#登录要指定ip和端口[root@master1~]#argocdlogin10.6.215.30:30495WARNING:servercertificatehaderror:x509:cannotv......
  • 云原生--argocd 仓库管理、集群管理
    前戏在我们之前添加应用的时候,都是在下图那里添加的,但如下图那样添加有个问题,就是我们的仓库需要认证,那是没有办法的,这时候我们就需要先将仓库设置好,在这里选择就可以了......