Get the FREE Ultimate OpenClaw Setup Guide →

argocd-gitops

Scanned
npx machina-cli add skill agenticdevops/devops-execution-engine/argocd-gitops --openclaw
Files (1)
SKILL.md
6.6 KB

ArgoCD GitOps

GitOps workflows for Kubernetes deployments using ArgoCD.

When to Use This Skill

Use this skill when:

  • Deploying applications via GitOps
  • Managing ArgoCD applications
  • Syncing or rolling back deployments
  • Troubleshooting sync issues

ArgoCD CLI Setup

Login

# Login to ArgoCD server
argocd login argocd.example.com

# With SSO
argocd login argocd.example.com --sso

# Skip TLS verification (dev only)
argocd login argocd.example.com --insecure

# Check current context
argocd context

Application Management

List Applications

# All applications
argocd app list

# With output format
argocd app list -o wide
argocd app list -o json

# Filter by project
argocd app list -p myproject

# Filter by label
argocd app list -l team=backend

View Application

# Application details
argocd app get myapp

# Manifests
argocd app manifests myapp

# Diff against live
argocd app diff myapp

# History
argocd app history myapp

Application Health

# Check status
argocd app get myapp -o json | jq '.status.health.status'

# Resources status
argocd app resources myapp

# Events
argocd app logs myapp

Sync Operations

Sync Application

# Sync (apply Git state to cluster)
argocd app sync myapp

# Sync with prune (remove deleted resources)
argocd app sync myapp --prune

# Sync specific resources
argocd app sync myapp --resource :Deployment:myapp

# Dry run
argocd app sync myapp --dry-run

# Force sync (bypass hooks)
argocd app sync myapp --force

# Wait for sync completion
argocd app wait myapp

Sync Options

# Skip schema validation
argocd app sync myapp --validate=false

# Apply out-of-sync only
argocd app sync myapp --apply-out-of-sync-only

# Sync with timeout
argocd app sync myapp --timeout 300

Auto-Sync

# Enable auto-sync
argocd app set myapp --sync-policy automated

# With prune
argocd app set myapp --sync-policy automated --auto-prune

# Self-heal (revert manual changes)
argocd app set myapp --self-heal

# Disable auto-sync
argocd app set myapp --sync-policy none

Rollback

Rollback to Previous

# View history
argocd app history myapp

# Rollback to specific revision
argocd app rollback myapp <history-id>

# Rollback to previous Git commit
argocd app rollback myapp --revision HEAD~1

Rollback Strategies

# 1. Rollback ArgoCD history
argocd app history myapp
argocd app rollback myapp 5

# 2. Revert Git commit and sync
git revert HEAD
git push
argocd app sync myapp

# 3. Manual override then rollback
argocd app set myapp --revision <old-commit>
argocd app sync myapp

Multi-Environment Promotion

Typical Flow

# 1. Deploy to dev (auto-sync)
git commit -m "feat: new feature"
git push origin main
# ArgoCD auto-syncs dev

# 2. Promote to staging
argocd app set myapp-staging --revision $(argocd app get myapp-dev -o json | jq -r '.status.sync.revision')
argocd app sync myapp-staging

# 3. Promote to production (manual)
argocd app set myapp-prod --revision <staging-revision>
argocd app sync myapp-prod

Environment-Specific Overrides

# Set Helm values per environment
argocd app set myapp-prod --values-literal-file values-prod.yaml

# Set Kustomize overlay
argocd app set myapp-staging --kustomize-image nginx=nginx:1.25

Create Applications

From Git Repository

argocd app create myapp \
  --repo https://github.com/org/repo.git \
  --path k8s/overlays/production \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production \
  --project default

# With Helm
argocd app create myapp \
  --repo https://github.com/org/repo.git \
  --path charts/myapp \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production \
  --helm-set image.tag=v1.2.3

From Helm Repository

argocd app create myapp \
  --repo https://charts.example.com \
  --helm-chart myapp \
  --revision 1.2.3 \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production

Troubleshooting

Sync Failures

# Check sync status
argocd app get myapp

# View sync errors
argocd app get myapp -o json | jq '.status.conditions'

# Check resource status
argocd app resources myapp

# View logs
argocd app logs myapp

Common Issues

IssueCauseFix
OutOfSyncDrift from Gitargocd app sync myapp
SyncFailedInvalid manifestsCheck argocd app get myapp
DegradedPods unhealthyCheck pod logs
UnknownCan't reach clusterCheck network/auth

Force Refresh

# Refresh from Git
argocd app get myapp --refresh

# Hard refresh (invalidate cache)
argocd app get myapp --hard-refresh

Stuck Sync

# Terminate current sync
argocd app terminate-op myapp

# Force sync
argocd app sync myapp --force

Project Management

# List projects
argocd proj list

# Create project
argocd proj create myproject \
  --src https://github.com/org/* \
  --dest https://kubernetes.default.svc,production

# View project
argocd proj get myproject

Clusters

# List clusters
argocd cluster list

# Add cluster
argocd cluster add my-context

# Remove cluster
argocd cluster rm https://cluster.example.com

Notifications (Status Checks)

# Get app health for CI/CD
argocd app wait myapp --health --timeout 300

# Exit code for scripting
argocd app get myapp -o json | jq -e '.status.health.status == "Healthy"'

Quick Reference

# Deploy new version
argocd app set myapp --revision <commit-sha>
argocd app sync myapp --prune

# Check if healthy
argocd app wait myapp --health

# Quick rollback
argocd app history myapp
argocd app rollback myapp <id>

# Force refresh from Git
argocd app get myapp --hard-refresh
argocd app sync myapp

GitOps Best Practices

  1. Never modify cluster directly - All changes through Git
  2. Use ApplicationSets - For multi-cluster/environment
  3. Enable auto-prune - Keep cluster clean
  4. Use sync waves - For ordered deployments
  5. Separate config repos - App code vs deployment config
  6. Review before production - Manual sync gates

Related Skills

  • k8s-deploy: For direct Kubernetes deployments
  • git-workflow: For managing GitOps repos
  • incident-response: For deployment-related incidents

Source

git clone https://github.com/agenticdevops/devops-execution-engine/blob/main/skills/argocd-gitops/SKILL.mdView on GitHub

Overview

ArgoCD GitOps enables Kubernetes deployment management by modeling the desired state in Git and continuously syncing it to the cluster. This skill covers logging in to ArgoCD, managing applications, performing sync operations (including prune, dry-run, and force), rolling back changes, and promoting releases across environments.

How This Skill Works

ArgoCD monitors the Git repository for the declared state and applies changes to the Kubernetes cluster to match it. Operators use the ArgoCD CLI to authenticate, list and inspect applications, view manifests and diffs, perform syncs (with options like prune, dry-run, and force), and roll back or promote across environments.

When to Use It

  • Deploying applications via GitOps
  • Managing ArgoCD applications
  • Syncing deployments to the desired Git state
  • Rolling back deployments to a previous revision
  • Promoting changes across environments (dev, staging, prod)

Quick Start

  1. Step 1: Login to the ArgoCD server: argocd login argocd.example.com
  2. Step 2: Create or select an app from Git: argocd app create myapp --repo https://github.com/org/repo.git --path k8s/overlays/production --dest-server https://kubernetes.default.svc --dest-namespace production --project default
  3. Step 3: Sync the app to apply the Git state: argocd app sync myapp

Best Practices

  • Treat Git as the single source of truth for all deployment manifests.
  • Enable prune and auto-sync only after validating changes in a non-prod environment.
  • Use argocd app diff and history to review changes before applying.
  • Enable auto-sync with self-heal for self-correcting clusters when Git state drifts.
  • Test sync in a dev or staging environment prior to production deployment and track the revision for rollback.

Example Use Cases

  • Deploy a new feature by committing to Git and letting ArgoCD auto-sync (dev).
  • Inspect a failing sync by viewing manifests and diffs, then revert or adjust the Git state.
  • Rollback to a previous commit by selecting a history-id and syncing the app.
  • Enable automated sync with prune for a production app and monitor health metrics.
  • Promote a change from dev to staging to prod by promoting revisions via ArgoCD.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers