Skill v1.0.1
currentAutomated scan100/100+1 new
version: "1.0.1" name: argocd description: Expert Argo CD GitOps assistance covering Application CRDs, sync policies, automated self-healing, Helm/Kustomize, and multi-cluster deployments. Use when managing Kubernetes deployments via GitOps.
ArgoCD
Argo CD is a declarative GitOps continuous delivery tool for Kubernetes, continuously reconciling active cluster state against Git repositories using ApplicationSets.
When to Use
- GitOps Continuous Delivery for Kubernetes: Declarative synchronization of Kubernetes manifests from Git to live clusters.
- Multi-Cluster Deployment Management: Centrally deploying and managing workloads across dozens of Kubernetes clusters.
- Automated Drift Detection & Self-Healing: Automatically detecting manual cluster mutations and reconciling desired state.
- Progressive Delivery with Argo Rollouts: Coordinating Canary and Blue-Green deployments with automated rollbacks.
Quick Start
# Application.yamlapiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: guestbooknamespace: argocdspec:project: defaultsource:repoURL: https://github.com/argoproj/argocd-example-apps.gittargetRevision: HEADpath: guestbookdestination:server: https://kubernetes.default.svcnamespace: guestbook
Core Concepts
Declarative Application CRD
Defining GitOps synchronization between a Git repository and cluster namespace:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: payment-service-prodnamespace: argocdfinalizers:- resources-finalizer.argocd.argoproj.iospec:project: defaultsource:repoURL: https://github.com/org/payment-manifests.gittargetRevision: mainpath: environments/productionhelm:valueFiles:- values.yaml- values-prod.yamldestination:server: https://kubernetes.default.svcnamespace: paymentssyncPolicy:automated:prune: true # Delete removed resourcesselfHeal: true # Revert out-of-band cluster editssyncOptions:- CreateNamespace=true- ApplyOutOfSyncOnly=trueretry:limit: 5backoff:duration: 5sfactor: 2maxDuration: 3m
App-of-Apps Pattern for Fleet Orchestration
Root application orchestrating multiple microservices:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: root-cluster-appnamespace: argocdspec:project: defaultsource:repoURL: https://github.com/org/gitops-fleet.gittargetRevision: mainpath: apps/productiondestination:server: https://kubernetes.default.svcnamespace: argocdsyncPolicy:automated:prune: trueselfHeal: true
Argo CD CLI Management
Syncing and monitoring deployments via the terminal:
# Log in to Argo CD serverargocd login cd.infra.internal --grpc-web --sso# Manually trigger synchronization and wait for health checkargocd app sync payment-service-prod --pruneargocd app wait payment-service-prod --health --timeout 300
Common Patterns
Declarative Argo CD Application Manifest
Problem: Manually creating Argo CD applications in the web UI makes disaster recovery difficult.
Solution: Commit declarative Application custom resources directly to Git:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata:name: payment-servicenamespace: argocdfinalizers:- resources-finalizer.argocd.argoproj.iospec:project: defaultsource:repoURL: "https://github.com/myorg/gitops-infra.git"targetRevision: mainpath: apps/payment-service/overlays/productiondestination:server: "https://kubernetes.default.svc"namespace: paymentssyncPolicy:automated:prune: trueselfHeal: truesyncOptions:- CreateNamespace=true
Best Practices
Do:
- Enable
selfHeal: trueandprune: trueto guarantee Git remains the single source of truth. - Adopt the App-of-Apps or ApplicationSet pattern to manage cluster applications hierarchically.
- Pin production
targetRevisionto explicit Git commit SHAs or release tags rather than floating branch names. - Protect secrets using external secret operators (Sealed Secrets, External Secrets Operator + Vault) rather than plain Git.
Don't:
- Allow direct
kubectl editin production clusters; enforce changes exclusively via Git pull requests. - Run Argo CD without RBAC and SSO integration (GitHub, Okta, or Keycloak).
- Omit
ApplyOutOfSyncOnly=truein large clusters; it prevents API server overload during reconcile loops.
Troubleshooting
| Error | Cause | Solution | |
|---|---|---|---|
ComparisonError: repository not found or authentication failed | Git repository credentials missing or expired SSH key in Argo CD. | Add repository credentials in Argo CD Settings > Repositories. | |
OutOfSync: Resource failed validation | Kubernetes manifest contains deprecated apiVersion or invalid schema. | Run kubectl apply --dry-run=client locally on the manifest. | |
Degraded: CrashLoopBackOff on child pod | Application container crashing due to missing env var or port conflict. | Inspect pod logs via kubectl logs -n <ns> <pod-name>. |