Tüm Ürünler
Search
Belge Merkezi

Container Service for Kubernetes:Submit a workflow to a specific namespace

Son Güncelleme:Oct 06, 2026

Argo Workflows, varsayılan olarak tüm iş akışlarını argo ad alanına gönderir. Kaynak ve izin yalıtımı sağlamak amacıyla iş akışlarını ayrı bir ad alanında çalıştırmak için hedef ad alanı için Rol Tabanlı Erişim Denetimi'ni (RBAC) yapılandırın ve iş akışını -n bayrağı ile gönderin.

Yaygın bir kullanım senaryosu şöyledir: Bir ekip CI/CD işlem hatlarını çalıştırırken başka bir ekip veri işleme görevlerini yürütüyorsa, ekiplerin argo ad alanını paylaşması yerine her ekibe kendi ad alanını atayın.

Ön koşullar

Başlamadan önce aşağıdaki gereksinimleri karşıladığınızdan emin olun:

  • kubectl yüklü ve ACK kümesine erişim için yapılandırılmış olmalı

  • Argo CLI (argo) yüklü olmalı

Bir ad alanına RBAC izinleri verin

1. Adım: Hedef ad alanını oluşturun

kubectl create ns test

2. Adım: Yetkilendirme dosyasını oluşturun

Aşağıdaki içeriğe sahip role-rolebinding.yaml adlı bir dosya oluşturun. Bu dosya, beş Rol ve dört RoleBinding tanımlar; tümü default hizmet hesabına bağlanır.

Uyarı

default hizmet hesabı paylaşılan bir hesaptır; diğer iş yükleri, sizin niyetiniz dışında bu hesaba izinler ekleyebilir. Üretim ortamlarındaki iş yükleri için default hesabını kullanmak yerine iş akışlarınız için özel bir hizmet hesabı oluşturun.

Argo Workflows sürümünüz v3.2 veya daha eskiyse, workflowtasksets/status ifadesini patch workflowtasksets ile değiştirin; bunu agent Rol kuralları içinde yapın.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    workflows.argoproj.io/description: |
      This is the minimum recommended permissions needed if you want to use the agent, e.g. for HTTP or plugin templates.

      If <= v3.2 you must replace `workflowtasksets/status` with `patch workflowtasksets`.
  name: agent
rules:
  - apiGroups:
      - argoproj.io
    resources:
      - workflowtasksets
    verbs:
      - list
      - watch
  - apiGroups:
      - argoproj.io
    resources:
      - workflowtasksets/status
    verbs:
      - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    workflows.argoproj.io/description: |
      This is the minimum recommended permissions needed if you want to use artifact GC.
  name: artifactgc
rules:
  - apiGroups:
      - argoproj.io
    resources:
      - workflowartifactgctasks
    verbs:
        - list
        - watch
  - apiGroups:
      - argoproj.io
    resources:
      - workflowartifactgctasks/status
    verbs:
      - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    workflows.argoproj.io/description: |
      Recommended minimum permissions for the `emissary` executor.
  name: executor
rules:
  - apiGroups:
      - argoproj.io
    resources:
      - workflowtaskresults
    verbs:
      - create
      - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: submit-workflow-template
rules:
  - apiGroups:
      - argoproj.io
    resources:
      - workfloweventbindings
    verbs:
      - list
  - apiGroups:
      - argoproj.io
    resources:
      - workflowtemplates
    verbs:
      - get
  - apiGroups:
      - argoproj.io
    resources:
      - workflows
    verbs:
      - create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    workflows.argoproj.io/description: |
      This is an example of the permissions you would need if you wanted to use a resource template to create and manage
      other workflows. The same pattern would be suitable for other resurces, e.g. a service
  name: workflow-manager
rules:
  - apiGroups:
      - argoproj.io
    resources:
      - workflows
    verbs:
      - create
      - get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: agent-default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: agent
subjects:
  - kind: ServiceAccount
    name: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: artifactgc-default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: artifactgc
subjects:
  - kind: ServiceAccount
    name: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: executor-default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: executor
subjects:
  - kind: ServiceAccount
    name: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: workflow-manager-default
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: workflow-manager
subjects:
  - kind: ServiceAccount
    name: default

3. Adım: Yetkilendirmeyi uygulayın

kubectl apply -f role-rolebinding.yaml -n test

Beklenen çıktı şu şekildedir:

role.rbac.authorization.k8s.io/agent created
role.rbac.authorization.k8s.io/artifactgc created
role.rbac.authorization.k8s.io/executor created
role.rbac.authorization.k8s.io/submit-workflow-template created
role.rbac.authorization.k8s.io/workflow-manager created
rolebinding.rbac.authorization.k8s.io/agent-default created
rolebinding.rbac.authorization.k8s.io/artifactgc-default created
rolebinding.rbac.authorization.k8s.io/executor-default created
rolebinding.rbac.authorization.k8s.io/workflow-manager-default created

İş akışını ad alanına gönderin

4. Adım: İş akışı dosyasını oluşturun

helloworld-workflow.yaml adlı bir dosya oluşturun:

apiVersion: argoproj.io/v1alpha1
kind: Workflow                # Defines a new Kubernetes resource type for Argo Workflows.
metadata:
  generateName: hello-world-  # The prefix for the workflow name. Kubernetes will append a unique suffix.
spec:
  entrypoint: main            # Specifies the template to execute first.
  templates:
    - name: main              # The name of the template.
      container:
        image: mirrors-ssl.aliyuncs.com/busybox:latest
        command: [ echo ]
        args: [ "hello world" ]

5. Adım: İş akışını gönderin

İş akışını test ad alanına gönderin:

argo submit helloworld-workflow.yaml -n test