argo workflows 部署记录

Overview

背景

Argo workflow 的教程中提供的 quick start 部署方案 , 不足以满足生产环境的要求

The workflow engine for Kubernetes

部署方式

  • 我们选用 github.com/argoproj/arg 项目提供的 argo-workflows chart 进行部署
  • 通过 helm 方式进行部署 , 操作简洁 , 易于更新 , 且已有成熟的部署方案
  • 部署 argo workflows 需要 artifact repo 和 database

artifact repo

我们选择 s3存储, 需要创建一个 secret 存放 s3 的 accessKey 和 secretKey

database

我们单独部署一个 postgresql 数据库供 argo-workflows 使用 - 通过 helm 方式部署 ,选用 bitnami/postgresql chart - 需要提前创建 secret 存放 postgresql 的 admin password, username, password (for username)

配置 & 安装

Namespace

kubectl create ns <namespace>

Database Secret

提前创建 secret 存放 postgresql 的 admin password, username, password (for username) 例如:

kubectl create secret -n argo-dev generic argo-workflows-postgresql \
  --from-literal=username=<username> \
  --from-literal=password=<password> \
  --from-literal=postgres-password=<postgres-password>

S3 Secret

artifact repo : 我们选择 s3存储, 需要创建一个 secret 存放 s3 的 accessKey 和 secretKey

例如 : s3/argo-s3-secret.yaml

apiVersion: v1
stringData:
  accessKey: <access-key-value>
  secretKey: <secret-key-value>
kind: Secret
metadata:
  name: argo-s3-secret
  labels:
    app: cos
type: Opaque
kubectl create secret -n <namespace> -f s3/argo-s3-secret.yaml

Postgresql

必选配置

postgresql/examples.yaml

global:
  postgresql:
    auth:
      username: "<username>"
      database: "argo_postgres"
      existingSecret: "argo-workflows-postgresql"
      secretKeys:
        adminPasswordKey: "postgres-password"
        userPasswordKey: "password"
primary:
  persistence:
    size: 10Gi
readReplicas:
  persistence:
    size: 10Gi

Helm

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

Install (& Upgrade)

helm upgrade --install -n <namespace> -f postgresql/example.yaml argo-workflows-postgresql bitnami/postgresql

Argo Workflows

Config

argo-workflows/exampls.yaml

controller:
  # -- enable persistence using postgres
  persistence:
    connectionPool:
      maxIdleConns: 100
      maxOpenConns: 0
    # save the entire workflow into etcd and DB
    nodeStatusOffLoad: false
    # enable archiving of old workflows
    archive: false
    postgresql:
      host: argo-workflows-postgresql
      port: 5432
      database: argo_postgres
      tableName: argo_workflows
      # the database secrets must be in the same namespace of the controller
      userNameSecret:
        name: argo-workflows-postgresql
        key: username
      passwordSecret:
        name: argo-workflows-postgresql
        key: password
artifactRepository:
  # -- Archive the main container logs as an artifact
  archiveLogs: false
  # -- Store artifact in a S3-compliant object store
  # @default -- See [values.yaml]
  s3:
    # Note the `key` attribute is not the actual secret, it's the PATH to
    # the contents in the associated secret, as defined by the `name` attribute.
    accessKeySecret:
      name: argo-s3-secret
      key: accessKey
    secretKeySecret:
      name: argo-s3-secret
      key: secretKey
    insecure: true
    bucket: <bucket>
    endpoint: <endpoint>
    region: <region>
全部配置参考 argo-helm/values.yaml

Helm

helm repo add argo https://argoproj.github.io/argo-helm
helm repo update

Install (& Upgrade)

helm upgrade --install -n <namespace> -f argo-helm/example.yaml argo-workflows argo/argo-workflows

测试

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

编辑于 2022-08-18 12:08