Skip to main content

argo-workflows

ben.wangzLess than 1 minute

argo-workflows

prepare

  1. k8s is ready
  2. argocd is ready and logged in
  3. ingress is ready
  4. cert-manager is ready
    • the clusterissuer named self-signed-ca-issuer is ready

installation

  1. prepare argo-workflows.yaml
    • apiVersion: argoproj.io/v1alpha1
      kind: Application
      metadata:
        name: argo-workflows
      spec:
        syncPolicy:
          syncOptions:
          - CreateNamespace=true
        project: default
        source:
          repoURL: https://argoproj.github.io/argo-helm
          chart: argo-workflows
          targetRevision: 0.40.11
          helm:
            releaseName: argo-workflows
            values: |
              crds:
                install: true
                keep: false
              singleNamespace: false
              controller:
                image:
                  registry: quay.io
                workflowNamespaces:
                  - business-workflows
              executor:
                image:
                  registry: quay.io
              workflow:
                serviceAccount:
                  create: true
                rbac:
                  create: true
              server:
                enabled: true
                image:
                  registry: quay.io
                ingress:
                  enabled: true
                  ingressClassName: nginx
                  annotations:
                    cert-manager.io/cluster-issuer: self-signed-ca-issuer
                    nginx.ingress.kubernetes.io/rewrite-target: /$1
                  hosts:
                    - argo-workflows.dev.geekcity.tech
                  paths:
                    - /?(.*)
                  tls:
                    - secretName: argo-workflows-tls
                      hosts:
                        - argo-workflows.dev.geekcity.tech
                authModes:
                  - server
                sso:
                  enabled: false
        destination:
          server: https://kubernetes.default.svc
          namespace: workflows
      
      
  2. prepare argo workflow client binary
    • MIRROR="files."
      VERSION=v3.5.4
      curl -sSLo argo-linux-amd64.gz "https://${MIRROR}github.com/argoproj/argo-workflows/releases/download/${VERSION}/argo-linux-amd64.gz"
      gunzip argo-linux-amd64.gz
      chmod u+x argo-linux-amd64
      mkdir -p ${HOME}/bin
      mv -f argo-linux-amd64 ${HOME}/bin/argo
      rm -f argo-linux-amd64.gz
      
      
  3. create business-workflows namespace to be controlled
    • NOTE: this should be set with controller.workflowNamespaces in the values of argo-workflows.yaml
    • kubectl get namespace business-workflows > /dev/null 2>&1 || kubectl create namespace business-workflows
      
  4. apply to k8s
    • kubectl -n argocd apply -f argo-workflows.yaml
      
  5. sync by argocd
    • argocd app sync argocd/argo-workflows
      

tests

hello world

  1. prepare hello-world.yaml
    • apiVersion: argoproj.io/v1alpha1
      kind: Workflow
      metadata:
        generateName: hello-world-
      spec:
        entrypoint: whalesay
        serviceAccountName: argo-workflow
        templates:
        - name: whalesay
          container:
            image: docker.io/docker/whalesay:latest
            command:
            - cowsay
            args:
            - hello world
      
      
  2. submit with argo workflow client
    • argo -n business-workflows submit hello-world.yaml
      
  3. check status
    • argo -n business-workflows list
      
    • # argo -n business-workflows get hello-world-m5kqf
      argo -n business-workflows get @lastest
      
    • # argo -n business-workflows logs hello-world-m5kqf
      argo -n business-workflows logs @latest
      

others

  1. publish container image
  2. deploy argocd app
  3. mirror container image