Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[ArgoWorkflows] Lesson 1: Installing Awgo-WorkFlows by the helm-chart and Demo a few simple templates.

Posted on January 2, 2022January 2, 2022 By nim No Comments on [ArgoWorkflows] Lesson 1: Installing Awgo-WorkFlows by the helm-chart and Demo a few simple templates.

Contents

  • 1) Install Awgo WorkFlows.
  • 2) Simple template
    • 2.1) container-template
    • 2.2) script-template
    • 2.3) resource-template

1) Install Awgo WorkFlows.

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

>>>value.yaml
server:
  extraArgs:
    - --auth-mode=server
singleNamespace: true
controller:
  containerRuntimeExecutor: emissary
  workflowDefaults:
   spec:
     serviceAccountName: argo-workflows-server
workflow:
  serviceAccount:
    create: true

2) Simple template

2.1) container-template

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: wf-container-template- # Name of this workflow
spec:
  entrypoint: container-template # defines "whalesay" as the "main" template
  templates:
  - name: container-template      #defining the "whalesay" template
    container:
      image: python:3.8-slim
      command: [echo, "Nimtechnology"]

Để chạy được cái này bạn chọn create nhé.
Mình apply thì nó báo lỗi.

kubectl -n argo create -f hello-world.yaml

https://argoproj.github.io/argo-workflows/workflow-executors/#kubelet-kubelet

Chỗ generateName: bạn nên đặt kiểu xxx-
Argoworkflow sẽ thêm 5 kí tự vào đó, để đảm bảo nó là unique.(Duy nhất)

generateName sẽ hỉnh là tên pod luôn

Workflow Executors thì mình đang chạy mode: Emissary (emissary)

Mình thấy có 3 pod.
Click vào trong sem có j hay

2.2) script-template

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: wf-script-template- # Name of this workflow
spec:
  entrypoint: script-template # defines "whalesay" as the "main" template
  templates:
  - name: script-template      #defining the "whalesay" template
    script:
      image: python:3.8-slim
      command: [python]
      source: |
        print("Nimtechnology - the script template was executed successfully.")

Anh/em tiếp tục: kubectl -n argo create

Ở nhưng Bài đầu này mình cũng gần như chưa thấy nhiều sự khách biệt giữa container-template và script-template.
Hiện tại mình chỉ thấy khách ở việc run command trong container.

2.3) resource-template

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: wf-resource-template- # Name of this workflow
spec:
  entrypoint: resource-template # defines "whalesay" as the "main" template
  templates:
  - name: script-template      #defining the "whalesay" template
    resource:
      action: create
      manifest: |
        apiVersion: argoproj.io/v1alpha1
        kind: Workflow
        metadata:
          generateName: wf-test
        spec:
          entrypoint: test-template
          templates:
          - name: test-template
            script:
              image: python:3.8-slim
              command: [python]
              source: |
                print("Nimtechnology - the script template was executed successfully.")
kubectl -n argo create -f wf-resource-template.yaml
>>>outout
workflow.argoproj.io/wf-resource-template-2t5n9 created

Đại loại thì lỗi trên là nó dùng 1 service acount là default mà SA default này lại ko có quyên tạo resource “workflows”

resolve this problem: https://github.com/argoproj/argo-workflows/issues/1021

Mình đoán là argo workflows sẽ có SA đáp đứng được điều kiện trên. Giờ đi tìm thôi.

chúng ta có 2 service accounts
Mình thấy argo-workflows-server này có tương lại
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app.kubernetes.io/component: server
    app.kubernetes.io/instance: argo-workflows
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: argo-workflows-server
    app.kubernetes.io/part-of: argo-workflows
    helm.sh/chart: argo-workflows-0.9.4
  name: argo-workflows-server
  namespace: argo
rules:
  - apiGroups:
      - ''
    resources:
      - configmaps
      - events
    verbs:
      - get
      - watch
      - list
  - apiGroups:
      - ''
    resources:
      - pods
      - pods/exec
      - pods/log
    verbs:
      - get
      - list
      - watch
      - delete
  - apiGroups:
      - ''
    resources:
      - secrets
    verbs:
      - get
  - apiGroups:
      - ''
    resources:
      - events
    verbs:
      - watch
      - create
      - patch
  - apiGroups:
      - argoproj.io
    resources:
      - eventsources
      - sensors
      - workflows
      - workfloweventbindings
      - workflowtemplates
      - cronworkflows
    verbs:
      - create
      - get
      - list
      - watch
      - update
      - patch
      - delete

Anh em có thể thấy là role khá nhiều quyền. Lấy service account service argo-workflows-server sài thôi

file value của helm chart sẽ là:

server:
  extraArgs:
    - --auth-mode=server
singleNamespace: true
controller:
  containerRuntimeExecutor: emissary
  workflowDefaults:
   spec:
     serviceAccountName: argo-workflows-server
workflow:
  serviceAccount:
    create: true

Giờ create lại yaml resource:

ArgoWorkflows, CI/CD

Post navigation

Previous Post: [Jenkins] Scripted Pipeline lesson 17: Triggers _ Cron.
Next Post: [Jenkins] Scripted Pipeline lesson 18: Triggers _ PollSCM

More Related Articles

[Argo-Workflows] Lesson3: Argo CLI and Input Parameters ArgoWorkflows
[ArgoCD]Hướng dẫn cấu hình argocd deploy application trên k8s bằng helm ArgoCD
[Argo-Workflows] Lesson5: Output Parameter ArgoWorkflows
[Jenkins – Kubernestes] Jenkins tạo Jenkins slave trên Kubernetes CI/CD
[Jenkins – Gitlab] Cấu hình Gitlab Group trên Jenkins và auto thêm webhook Jenkins trên Gitlab CI/CD
[Kaniko/Bitbucket/ECR] Accomplish the workflow: CI by bitbucket pipeline, Kaniko build image and push image to ECR AWS - Amazon Web Service

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Prometheus/Grafana] Install Prometheus and Grafana on ubuntu. March 27, 2023
  • [Kong Gateway] WebSocket connection failed March 26, 2023
  • [Nextcloud] Can’t download files to have a size bigger than 2Gi on NextCloud – RaspBerry March 24, 2023
  • [Datadog] Using DataDog to monitor all services on kubernetes March 19, 2023
  • [Metrics Server] Failed to make webhook authorizer request: the server could not find the requested resource March 17, 2023

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • MetalLB
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.