Skip to content

Instantly share code, notes, and snippets.

@foxutech
Created June 19, 2022 11:48
Show Gist options
  • Save foxutech/d6694e65edd18185a8699e2ed7a2ec12 to your computer and use it in GitHub Desktop.
Save foxutech/d6694e65edd18185a8699e2ed7a2ec12 to your computer and use it in GitHub Desktop.
This all some basic commands to check Argo CD Instance resources from CLI. Check our blog to know more about Argo CD https://foxutech.com/
To add the repo:
argocd repo add https://github.com/foxutech/kubernetes.git --username foxutech --password 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
To create a application:
# argocd app create kustom-check --repo https://github.com/foxutech/kubernetes.git --path kustomize/overlays/prod/ --dest-server https://kubernetes.default.svc --dest-namespace argocdtest
To Add the Cluster to ArgoCD
# argocd cluster add staging-azure
To check the list of Clusters
# argocd cluster list
To check the Application history
# argocd app history kustom-check
To roll-back to previous version
# argocd app rollback kustom-check 0 (get the rollback ID from history command)
To check the application is sync or not
# if argocd app list -r https://github.com/foxutech/kubernetes.git | awk '{print $1, $5}'| grep -q "Synced"; then echo "app is in sync"; else echo "app is in OutOfSync, try to sync via UI or argocd app sync APPLICATION-NAME"; fi
To check cluster sync details
# if argocd cluster list | awk '{print $1, $4}'| grep -q "Successful"; then echo "Cluster connection is successful"; else echo "Cluster connection is not successful, Check the connection using "argocd cluster get in-cluster" or "argocd cluster get `argocd cluster list | awk '{print $1}'| sed -n 2p`" or in UI"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment