Argo Workflows-Kubernetes的工作流引擎

2024-08-08  本文已影响0人  87d6dc4b11a7

Argo CD关注于自动化应用的部署和管理的持续集成和持续部署流程,而Argo Workflows则专注于在Kubernetes上编排和执行复杂的工作流任务。

什么是 Argo Workflows?

Argo Workflows 是一个开源的容器原生工作流引擎,用于在 Kubernetes 上编排并行作业。Argo Workflows 是作为 Kubernetes CRD (自定义资源定义)实现的。

安装 Argo Workflows

kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v<<ARGO_WORKFLOWS_VERSION>>/install.yaml
//使用最新版本
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/latest/download/install.yaml

安装完成后,如下


端口转发

kubectl edit service argo-server -n argo
----
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"argo-server","namespace":"argo"},"spec":{"ports":[{"name":"web","port":2746,"targetPort":2746}],"selector":{"app":"argo-server"}}}
  creationTimestamp: "2023-01-02T13:55:29Z"
  name: argo-server
  namespace: argo
  resourceVersion: "167527"
  uid: c0c42005-a4e4-4a43-82d6-5ff3d002c209
spec:
  clusterIP: 10.233.37.209
  clusterIPs:
  - 10.233.37.209
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: web
    nodePort: 32746    // 设置端口号
    port: 2746
    protocol: TCP
    targetPort: 2746
  selector:
    app: argo-server
  sessionAffinity: None
  type: NodePort     //修改为NodePort 
status:
  loadBalancer: {}

需要注意的是,这里默认的配置下,服务器设置了自签名的证书提供 HTTPS 服务,因此,确保你使用 https:// 协议进行访问。例如,地址为:https://192.168.59.59:32746/

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

安装 Argo Workflows CLI

# Download the binary
curl -sLO https://github.com/argoproj/argo/releases/download/v3.0.0-rc4/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

安装完成后,使用以下命令校验是否安装成功。

argo version

主要命令

argo submit hello-world.yaml    # submit a workflow spec to Kubernetes
argo list                       # list current workflows
argo get hello-world-xxx        # get info about a specific workflow
argo logs hello-world-xxx       # print the logs from a workflow
argo delete hello-world-xxx     # delete workflow

也可以使用kubectl直接运行工作流规范,但是Argo CLI提供语法检查、更好的输出,并且需要更少的输入。

问题1、拉取argoexec镜像失败

Back-off pulling image "quay.io/argoproj/argoexec:v3.5.10"

默认 argoexec 会从 quay.io/rgoproj/argoexec:<版本> 拉取镜像,可以通过修改 Argo Workflowsworkflow-controller-configmap 配置项,设置从私有部署的镜像仓库拉取镜像,减少镜像拉取时间,提高 Pod 的运行效率。

executor: |
    imagePullPolicy: IfNotPresent
    image: 10.4.0.xxx:5443/argoproj/argoexec:v3.5.5
    resources:
      requests:
        cpu: 10m
        memory: 64Mi

参考:
https://github.com/argoproj/argo-workflows/
https://argo-workflows.readthedocs.io/en/latest/
https://zhuanlan.zhihu.com/p/441580936

上一篇下一篇

猜你喜欢

热点阅读