The Application resource

Source, destination, and sync.

Advanced12 min · lesson 2 of 12

The core object is the Application, a Kubernetes custom resource that ties a source to a destination. The source is where the desired manifests live — a Git repo, a path within it, and a target revision (a branch, tag, or commit). The destination is where they should run — a cluster and a namespace. Argo CD watches the source and keeps the destination in sync with it. You can create Applications in the UI, via the CLI, or (best) declaratively as YAML that itself lives in Git.

application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: payments-api
namespace: argocd
spec:
project: default
source:
repoURL: https://git.acme.internal/apps/payments.git
path: k8s/overlays/prod
targetRevision: v1.4.0 # branch, tag, or commit
destination:
server: https://kubernetes.default.svc
namespace: payments
syncPolicy:
syncOptions: [CreateNamespace=true]

Declarative apps and target revision

Managing Applications declaratively (their YAML in Git) is the GitOps-native way — the definition of what is deployed is itself version-controlled and reviewed, not clicked into a UI. targetRevision is a key control: pointing at a tag or a specific commit gives you reproducible, promotable deploys (the same discipline as pinning image digests), while pointing at a mutable branch means the app tracks whatever lands there. Pin for production; track a branch only where you want continuous updates.

targetRevision: HEAD tracks a moving branch
Setting targetRevision to a branch (or HEAD) means the Application deploys whatever is on that branch right now, so a merge deploys to production automatically. That is fine for a dev environment but risky for prod, where you usually want to pin a tag or commit and promote deliberately. Choose the revision per environment: pinned and promoted for prod, branch-tracking only where continuous deployment is intended.