Argocd

From G1Joshi/Agent-Skills · View interactive version

Argocd is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. 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.

How to use this skill

Skill file

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

Quick Start

# Application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: guestbook

Core Concepts

Declarative Application CRD

Defining GitOps synchronization between a Git repository and cluster namespace:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: payment-service-prod
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: https://github.com/org/payment-manifests.git
    targetRevision: main
    path: environments/production
    helm:
      valueFiles:
        - values.yaml
        - values-prod.yaml
  destination:
    server: https://kubernetes.default.svc
    namespace: payments
  syncPolicy:
    automated:
      prune: true # Delete removed resources
      selfHeal: true # Revert out-of-band cluster edits
    syncOptions:
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m

App-of-Apps Pattern for Fleet Orchestration

Root application orchestrating multiple microservices:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: root-cluster-app
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/org/gitops-fleet.git
    targetRevision: main
    path: apps/production
  destination:
    server: https://kubernetes.default.svc
    namespace: argocd
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

Argo CD CLI Management

Syncing and monitoring deployments via the terminal:

# Log in to Argo CD server
argocd login cd.infra.internal --grpc-web --sso

# Manually trigger synchronization and wait for health check
argocd app sync payment-service-prod --prune
argocd 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/v1alpha1
kind: Application
metadata:
  name: payment-service
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: "https://github.com/myorg/gitops-infra.git"
    targetRevision: main
    path: apps/payment-service/overlays/production
  destination:
    server: "https://kubernetes.default.svc"
    namespace: payments
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

Best Practices

Do:

Don't:

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>. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.