Skip to content
Latchkey

How to Create an Argo CD Application

An Argo CD Application is a custom resource that maps a Git source (repo, path, revision) to a destination cluster and namespace.

Write an Application manifest with spec.source (repo, path, targetRevision) and spec.destination. Add an automated syncPolicy so Argo CD reconciles whenever Git changes.

Steps

  • Create an Application in the argocd namespace.
  • Set source to your repo, path, and targetRevision.
  • Set destination to the target cluster server and namespace.
  • Add syncPolicy.automated with prune and selfHeal.

Application manifest

apps/api/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: api
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/my-org/deploy-config
    path: apps/api
    targetRevision: main
  destination:
    server: https://kubernetes.default.svc
    namespace: api
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

Gotchas

  • prune: true deletes resources removed from Git; without it, deleted manifests linger in the cluster.
  • selfHeal: true reverts manual kubectl edits, which is what makes GitOps authoritative.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →