applicationset icon indicating copy to clipboard operation
applicationset copied to clipboard

ApplicationSet cannot access external AKS Clusters

Open JimFran opened this issue 3 years ago • 2 comments

Hello,

I have ArgoCD deployed in a Cluster "AKSTest01" and I would like to deploy a different app in an other cluster "AKSTest02" (This is a totally clean AKS cluster. I have just checked for the loadbalancer IP created by default).

At the moment I just deployed ArgoCD in "AKSTest01" and added the repo where I have the application for "AKSTest02" Cluster.

I am trying to connect my ArgoCD instance through an applicationset yml file to an external AKS cluster. Howerver I am getting an error most probably because I have to "connect" argoCD with the other cluster "AKSTest02":

Error message

  Generators:
    List:
      Elements:
        Cluster:  AKSTest02
        URL:      https://xx.94.151.xx
  Template:
    Metadata:
      Name:  {{cluster}}-guestbook
    Spec:
      Destination:
        Namespace:  guestbook
        Server:     {{url}}
      Project:      default
      Source:
        Path:             app/{{cluster}}
        Repo URL:         https://[email protected]/xxx/Test/_git/Test
        Target Revision:  HEAD
Status:
  Conditions:
    Last Transition Time:  2021-11-12T09:38:57Z
    Message:               application spec is invalid: InvalidSpecError: cluster 'https://xx.94.151.xx' has not been configured
    Reason:                ApplicationValidationError
    Status:                True
    Type:                  ErrorOccurred
    Last Transition Time:  2021-11-12T09:09:40Z
    Message:               Successfully generated parameters for all Applications
    Reason:                ParametersGenerated
    Status:                True
    Type:                  ParametersGenerated
    Last Transition Time:  2021-11-12T09:38:57Z
    Message:               application spec is invalid: InvalidSpecError: cluster 'https://xx.94.151.xx' has not been configured
    Reason:                ApplicationValidationError
    Status:                False
    Type:                  ResourcesUpToDate
Events:                    <none>

ApplicationSet.yml

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: guestbook
spec:
  generators:
  - list: 
      # Parameters are generated based on this cluster list, to be substituted
      # into the template below.
      elements: 
      - cluster: AKSTest02
        url: https://xx.94.151.xx
  template: 
    # An Argo CD Application template, with support for parameter substitution 
    # with values from parameters generated above.
    metadata:
      name: '{{cluster}}-guestbook'
    spec:
      project: default
      source:
        repoURL: https://[email protected]/xxx/Test/_git/Test
        targetRevision: HEAD
        path: app/{{cluster}}
      destination:
        server: '{{url}}'
        namespace: guestbook

Is there any way to include the credentials from AKSTest02 to my current ArgoCD instance? Is my configuration correct?

Regards,

JimFran avatar Nov 12 '21 11:11 JimFran

Cluster configuration is handled by Argo CD, see https://argo-cd.readthedocs.io/en/stable/getting_started/#5-register-a-cluster-to-deploy-apps-to-optional and/or https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#clusters

A cluster must first be defined (and working) within Argo CD, before ApplicationSet controller can use it.

jgwest avatar Nov 16 '21 15:11 jgwest

I ended-up here... Maybe it can help: instead of using ...spec.destination.server (URL of the kube endpoint) I should have use `...spec.destination.name" (name of the cluster registered in argocd)

xavbourdeau avatar Sep 22 '22 12:09 xavbourdeau