Argo CD Argo CD

Manage Applications with the Argo CD CLI

Log in, create, inspect, diff, sync, and roll back applications from the terminal.

10 min Beginner

Everything in the web UI is also available through the argocd CLI, which is what you’ll use in scripts and when you want to preview a change before applying it. This guide assumes Argo CD is installed and the port-forward from the install guide is running.

Install the CLI and log in

Install the CLI (brew install argocd on macOS, or download a binary from the releases page) and check it works:

argocd version --client

Log in to the API server through the port-forward. --insecure skips verification of the self-signed certificate, which is acceptable locally but not for a real installation:

argocd login localhost:8080 --username admin --password '<initial-password>' --insecure

Run argocd --help to list commands. Most of your day-to-day work is under argocd app.

Create and inspect applications

Create an application from flags instead of a manifest:

argocd app create webapp-prod \
  --repo https://github.com/your-org/webapp-config.git \
  --path prod \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace webapp-prod \
  --sync-option CreateNamespace=true

If you don’t set a sync policy, the application is manual. Then look at what exists:

argocd app list
argocd app get webapp-prod

list shows every application with its cluster, namespace, project, sync status, health, and sync policy. get shows one application’s details and its resources.

Preview and sync

A freshly created manual application reports OutOfSync and Missing, because nothing has been applied yet. Before syncing, you can see exactly what would change:

argocd app diff webapp-prod
argocd app sync webapp-prod
argocd app wait webapp-prod --health

If a sync fails, the error is printed for you. A common one is a destination namespace that doesn’t exist yet. That’s what the CreateNamespace=true option above is for. After making a change in Git, argocd app diff is a quick way to review it before you sync, and it shows the same information as the App Diff view in the UI.

Review history, roll back, and read logs

argocd app history webapp-prod
argocd app rollback webapp-prod <ID>
argocd app logs webapp-prod

history lists deployed revisions with their IDs. rollback returns to one of them, and as covered in the sync policy guide, it only works while automated sync is disabled. logs streams the logs of the application’s Pods, which is handy for a first look at a rollout.

Change settings and clean up

Update an application’s settings without editing YAML:

argocd app set webapp-prod --sync-policy automated --auto-prune --self-heal

Run argocd app set --help to see everything you can change. When you’re done with an application, delete it:

argocd app delete webapp-prod

By default this also removes the resources the application created, so it can take a minute to finish. Run argocd app list afterwards to confirm it’s gone.

Popular Guides