Argo CD Application Manifest Examples
This document provides examples of Argo CD Application resources, which are used to declaratively define and deploy applications within a Kubernetes cluster. Argo CD continuously monitors your applications and keeps them in sync with the desired state defined in these manifests.
Example 1: Deploying an Application from a Git Repository
This manifest defines an Argo CD Application that deploys resources from a specific path within a Git repository.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: unify-prod # Name of the Argo CD Application
namespace: argocd # Namespace where the Argo CD Application resource itself resides
spec:
project: default # Argo CD project to which this application belongs
source:
repoURL: 'https://github.com/example-org/k3s.git' # URL of the Git repository
targetRevision: main # Git revision (branch, tag, or commit) to track
path: k3s/apps/unify/overlays/prod # Path within the repository containing the Kubernetes manifests
destination:
server: https://kubernetes.default.svc # The Kubernetes API server URL for the target cluster
namespace: unify # The target namespace in the Kubernetes cluster where resources will be deployed
syncPolicy:
automated:
selfHeal: true # Automatically attempts to revert any manual changes to desired state
prune: true # Automatically deletes resources that are no longer defined in Git
syncOptions:
- CreateNamespace=true # Automatically creates the target namespace if it doesn't existExample 2: Deploying a Helm Chart (kube-prometheus-stack)
This manifest defines an Argo CD Application that deploys a Helm chart from a Helm repository, specifying custom values. This example shows the deployment of the kube-prometheus-stack, which includes Prometheus, Grafana, and Alertmanager.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kube-prometheus-stack # Name of the Argo CD Application
namespace: argocd # Namespace where the Argo CD Application resource itself resides
finalizers:
- resources-finalizer.argocd.argoproj.io # Ensures resources are cleaned up by Argo CD on deletion
spec:
project: default # Argo CD project to which this application belongs
source:
repoURL: https://prometheus-community.github.io/helm-charts # URL of the Helm chart repository
chart: kube-prometheus-stack # Name of the Helm chart to deploy
targetRevision: 58.0.0 # Specific version of the Helm chart
helm:
values: | # Inline Helm values (can also be from a separate file)
grafana:
enabled: true
adminPassword: <GRAFANA_ADMIN_PASSWORD> # Use Kubernetes Secrets or Vault in real deployments
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
hosts:
- grafana.example.internal
tls:
- hosts:
- grafana.example.internal
secretName: grafana-tls
prometheus:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
hosts:
- prometheus.example.internal
tls:
- hosts:
- prometheus.example.internal
secretName: prometheus-tls
alertmanager:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/router.entrypoints: websecure
hosts:
- alertmanager.example.internal
tls:
- hosts:
- alertmanager.example.internal
secretName: alertmanager-tls
prometheusOperator:
admissionWebhooks:
enabled: false # Optional, can help avoid cert issues in some setups
destination:
server: https://kubernetes.default.svc # The Kubernetes API server URL for the target cluster
namespace: monitoring # The target namespace for deploying these resources
syncPolicy:
automated:
prune: true # Automatically deletes resources that are no longer defined in Git/Helm chart
selfHeal: true # Automatically attempts to revert any manual changes to desired state
syncOptions:
- CreateNamespace=true # Automatically creates the target namespace if it doesn't exist