Installation

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes ([[kubernetes]]). It allows application definitions, configurations, and environments should be declarative and version controlled. Application deployment and lifecycle management should be automated, auditable, and easy to understand.

Documentation & Project Homepage: Argo CD Docs


Installation

  1. Install Argo CD on a Kubernetes ([[kubernetes]]) Cluster, using kubectl ([[kubectl]]).
1kubectl create namespace argocd
2
3kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  1. Add Traefik IngressRoute ([[traefik]]).
 1apiVersion: traefik.containo.us/v1alpha1
 2kind: IngressRoute
 3metadata:
 4  name: argocd-server
 5  namespace: argocd
 6spec:
 7  entryPoints:
 8    - websecure
 9  routes:
10    - kind: Rule
11      match: Host(`argocd.example.com`)
12      priority: 10
13      services:
14        - name: argocd-server
15          port: 80
16    - kind: Rule
17      match: Host(`argocd.example.com`) && Headers(`Content-Type`, `application/grpc`)
18      priority: 11
19      services:
20        - name: argocd-server
21          port: 80
22          scheme: h2c
23  tls:
24    certResolver: default
  1. Disable internal TLS

Edit the --insecure flag in the argocd-server command of the argocd-server deployment, or simply set server.insecure: "true" in the argocd-cmd-params-cm ConfigMap.


Get the admin password

For Argo CD v1.8 and earlier, the initial password is set to the name of the server pod, for Argo CD v1.9 and later, the initial password is available from a secret named argocd-initial-admin-secret.

1kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

Configuration

Add private GitHub Repositories

  1. Create a github token: https://github.com/settings/tokens

  2. Add new repository in ArgoCD via kubectl ([[kubectl]]) or the GUI

 1apiVersion: v1  
 2kind: Secret  
 3metadata:  
 4  name: repo-private-1
 5  labels:  
 6    argocd.argoproj.io/secret-type: repository  
 7stringData:  
 8  url: https://github.com/xcad2k/private-repo 
 9  password: <github-token> 
10  username: not-used
  1. Verify new repository is connected

Declarative Application and ApplicationSet

Apart from using the WebUI to add managed apps to ArgoCD, you can configure Application and ApplicationSet resources. This enables you to define not only ArgoCD and your apps as code, but also the definition which application you want to manage. With apps defined as YAML via an Application, you can e.g. deploy the app within a CI/CD pipeline that deploys your Argo instance.

There are two types of resources. Application and ApplicationSet. The main difference is, that you can specify so called inline generators which allow you to template your Application definition. If you manage multiple clusters with ArgoCD and you want to get an Application deployed with cluster specific parameters you want to use an ApplicationSet.

Below, you find an example for an Application and an ApplicationSet.

Application:

 1apiVersion: argoproj.io/v1alpha1
 2kind: Application
 3metadata:
 4  name: guestbook
 5  namespace: argocd
 6spec:
 7  destination:
 8    namespace: default
 9    server: 'https://kubernetes.default.svc'
10  source:
11    path: kustomize-guestbook
12    repoURL: 'https://github.com/argoproj/argocd-example-apps'
13    targetRevision: HEAD
14  project: default
15  syncPolicy:
16    automated:
17      prune: false
18      selfHeal: false

ApplicationSet:

 1apiVersion: argoproj.io/v1alpha1
 2kind: ApplicationSet
 3metadata:
 4  name: guestbook
 5  namespace: argocd
 6spec:
 7  generators:
 8  - clusters: {} # This is a generator, specifically, a cluster generator.
 9  template: 
10    # This is a template Argo CD Application, but with support for parameter substitution.
11    metadata:
12      name: '{{name}}-guestbook'
13    spec:
14      project: "default"
15      source:
16        repoURL: https://github.com/argoproj/argocd-example-apps/
17        targetRevision: HEAD
18        path: kustomize-guestbook
19      destination:
20        server: '{{server}}'
21        namespace: default

Further information

More examples and tutorials regarding ArgoCD can be found in the link list below: