Skip to content

Latest commit

 

History

History
194 lines (133 loc) · 4.64 KB

File metadata and controls

194 lines (133 loc) · 4.64 KB
name argocd-ops
description Operate existing ArgoCD applications via the argocd CLI — check sync status, refresh or hard-refresh apps, look up Application names from ApplicationSets, toggle auto-sync and self-heal, and log into ArgoCD via SSO. Use this skill whenever the user mentions ArgoCD sync status, ArgoCD app refresh, ArgoCD login, disabling or enabling auto-sync or self-heal, looking up ArgoCD applications, or checking if a deploy has synced. This is for day-to-day ArgoCD operations, not for installing ArgoCD, writing ApplicationSet manifests, configuring RBAC, or setting up notifications.
model claude-haiku-4-5-20251001
allowed-tools
Bash(argocd:*)
Bash(kubectl:*)
Bash(jq:*)
Bash(rg:*)

ArgoCD Operations Skill

Manage ArgoCD applications via CLI for common deployment and debugging tasks.

When to Use

Use this skill when:

  • Verifying sync status after deploying changes
  • Looking up Application names from ApplicationSets
  • Refreshing an app to re-evaluate state
  • Toggling auto-sync or self-heal settings
  • Manually triggering a Job from a CronJob and watching logs

Prerequisites

Ensure these tools are available:

  • argocd - ArgoCD CLI
  • kubectl - configured with cluster contexts
  • jq - for JSON parsing

Workflow

Step 1: Gather Information

Ask the user for:

  1. Cluster - Which cluster to connect to (e.g., test, staging, prod, apps, ops)
  2. Operation - What they want to do (sync check, refresh, toggle settings, run job)

Step 2: Login to ArgoCD

Login via SSO:

# Determine server
ARGOCD_SERVER="argocd.<cluster>.tatari.dev"

# Login via SSO
argocd login "$ARGOCD_SERVER" --sso --grpc-web

Step 3: Perform Operations

Verify Sync Status

Check current sync and health status:

argocd app get <app-name> -o json | jq '{
  name: .metadata.name,
  syncStatus: .status.sync.status,
  healthStatus: .status.health.status,
  revision: .status.sync.revision
}'

Wait for sync to complete:

argocd app wait <app-name> --sync --timeout 300

Lookup App from ApplicationSet

Find the Application name generated by an ApplicationSet:

argocd app list -o json | jq -r --arg appset "<appset-name>" \
  '.[] | select(.metadata.ownerReferences[]?.name == $appset) | .metadata.name'

Refresh / Hard Refresh

Soft refresh (re-read git, compare):

argocd app get <app-name> --refresh

Hard refresh (invalidate cache, force manifest regeneration):

argocd app get <app-name> --hard-refresh

Toggle Auto-Sync

Enable auto-sync:

argocd app set <app-name> --sync-policy automated

Disable auto-sync:

argocd app set <app-name> --sync-policy manual

Toggle Self-Heal

Enable self-heal:

argocd app set <app-name> --self-heal

Disable self-heal (requires patch since no direct flag exists):

argocd app patch <app-name> --type merge \
  --patch '{"spec":{"syncPolicy":{"automated":{"selfHeal":false}}}}'

Note: Disabling auto-sync entirely (--sync-policy manual) also stops self-heal behavior.

Trigger Job from CronJob

Create a Job from an existing CronJob and watch its logs:

# Create job with timestamp suffix
JOB_NAME="<cronjob-name>-manual-$(date +%s)"
kubectl --context <cluster> create job "$JOB_NAME" \
  --from=cronjob/<cronjob-name> -n <namespace>

# Wait for pod to start
kubectl --context <cluster> wait --for=condition=Ready pod \
  -l job-name="$JOB_NAME" -n <namespace> --timeout=120s

# Stream logs until completion
kubectl --context <cluster> logs -f -l job-name="$JOB_NAME" -n <namespace>

# Check final status
kubectl --context <cluster> get job "$JOB_NAME" -n <namespace> \
  -o jsonpath='{.status.conditions[0].type}'

Troubleshooting

Login fails

# Verify cluster context exists
kubectl config get-contexts | grep <cluster>

# Ensure a browser is available for the SSO flow
# If running headless or over SSH, SSO login will not work

App not found

# List all apps
argocd app list

# Check if app exists via kubectl
kubectl --context <cluster> get applications -n argocd

Self-heal won't disable

The --self-heal flag only enables, it cannot disable. Use the patch command:

argocd app patch <app-name> --type merge \
  --patch '{"spec":{"syncPolicy":{"automated":{"selfHeal":false}}}}'

Job pod not starting

# Check job status
kubectl --context <cluster> describe job <job-name> -n <namespace>

# Check for pending pods
kubectl --context <cluster> get pods -l job-name=<job-name> -n <namespace>

# Check events
kubectl --context <cluster> get events -n <namespace> --sort-by='.lastTimestamp' | tail -20