ArgoCD:如何在 ArgoCD 中部署和定位特定集群?

ArgoCD: How to deploy and target specific cluster in ArgoCD?

在 ArgoCD 中如何将部署定位到特定集群或多集群环境中的一组集群?

我发现部署到多个集群的正确方法是使用生成器,带有如下选择器的集群:

generators:
  - clusters:
      selector:
        matchLabels:
          staging: true

完整示例:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: bgd
  namespace: openshift-gitops
spec:
  generators:
  - clusters:
      selector:
        matchLabels:
          bgd: dev
  template:
    metadata:
      name: '{{name}}-bgd'
    spec:
      project: default
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
      source:
        repoURL: https://github.com/christianh814/gitops-examples
        targetRevision: master
        path: applicationsets/cluster-generator/overlays/dev/
      destination:
        server: '{{server}}'
        namespace: bgd

可以在此处找到更多详细信息:https://cloud.redhat.com/blog/getting-started-with-applicationsets