An Application connects one source in Git to one destination in a cluster:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: shop-api-dev
namespace: argocd # Applications live in the Argo CD namespace
spec:
project: default # AppProject: guard rails (module 3)
source:
repoURL: https://github.com/example-org/shop-config.git
targetRevision: main # branch, tag or commit SHA
path: apps/shop-api/overlays/dev # folder inside the repo
destination:
server: https://kubernetes.default.svc # the cluster Argo CD runs in
namespace: shop-dev
syncPolicy:
syncOptions: [CreateNamespace=true]
| Field | Meaning |
|---|---|
source.repoURL |
Git (HTTPS or SSH), a Helm repository or an OCI registry |
targetRevision |
What to track. A branch follows new commits; a tag or SHA is fixed |
source.path |
Folder with YAML, a Kustomize overlay or a Helm chart; Argo CD detects the type |
destination.server / name |
Target cluster by API URL or by registered name |
destination.namespace |
Default namespace for objects that do not set one |
project |
The AppProject that limits repos, clusters and resource kinds |
Three ways to create it
# 1. CLI
argocd app create shop-api-dev \
--repo https://github.com/example-org/shop-config.git \
--path apps/shop-api/overlays/dev --revision main \
--dest-server https://kubernetes.default.svc --dest-namespace shop-dev \
--sync-option CreateNamespace=true
# 2. Declaratively – the GitOps way
kubectl apply -n argocd -f shop-api-dev.yaml
# 3. Web UI: + NEW APP
The declarative way is preferred: the Application YAML itself goes into Git (the "app of apps" pattern in module 3 manages these files for you).
Sync it
A new Application starts OutOfSync and Missing: Git has objects the cluster does not. Without an automated policy nothing happens until you sync:
argocd app sync shop-api-dev
argocd app wait shop-api-dev --health --timeout 120
argocd app get shop-api-dev
argocd app get lists every resource with its own sync and health status, plus the revision (commit SHA) that was applied — the link between the cluster and a line in the Git history.
Delete carefully
argocd app delete shop-api-dev # cascade: also deletes the Deployment, Service ...
argocd app delete shop-api-dev --cascade=false # keep the workloads, remove only the Application
With kubectl delete application, cascading only happens if the Application carries the finalizer resources-finalizer.argocd.argoproj.io. Without it, the workloads stay running but become unmanaged.
Tip: name Applications <app>-<env> and use labels (team=shop, env=dev) so argocd app list -l env=prod works.