Skip to main content
This lesson shows how to administer Argo CD using the CLI to perform the same tasks normally done in the web UI. You will:
  • Log in to Argo CD via the CLI
  • Create an application from a Git repo
  • Sync and monitor application status
  • Enable automated sync, self-heal, and auto-prune
  • Test self-heal behavior and observe Kubernetes events
  • Use argocd app wait to block until sync completes
This is useful for scripting GitOps operations, automation, and CI/CD integrations.

Login to Argo CD

In this environment Argo CD is exposed via a NodePort on localhost:30080. Authenticate with the admin account from the CLI:
Console output:
This login uses plaintext credentials and --insecure (disables TLS verification). It’s acceptable for lab environments but should never be used in production. For production, use secure credentials and TLS.

Create the application

Create an Argo CD Application named web-frontend that points to the example repository and guestbook path:
Console output:
Check the application status (initially Manual sync; resources are not yet deployed):
Representative output (initial state):
Confirm there are no Kubernetes resources deployed in the applications namespace yet:
Output:

Sync the application

Deploy the resources defined in Git by triggering a sync:
Console output (sync events and final state):
Now verify the Pods are running in the applications namespace:
Output:

Enable automated sync, self-heal, and auto-prune

By default Argo CD Applications use Manual sync. To have Argo CD automatically reconcile the live cluster to the Git state, and to prune removed resources, enable the following settings. Set automated sync:
Enable self-heal (auto-reconcile out-of-band changes):
Enable auto-prune (remove resources that were deleted from Git):
Verify the application now shows Automated (Prune) and self-heal behavior:
Representative output:

Test self-heal behavior

Simulate an out-of-band change by scaling the deployment directly with kubectl:
Console output:
Argo CD (with automated sync + self-heal) should detect the divergence and revert the replica count back to what’s declared in Git. Check status and pods again:
Representative outputs:
Describe the Deployment to view events that show Kubernetes scaling up and then Argo CD reverting the change:
Relevant events excerpt:

Wait for sync to complete

If you need to block until an application reaches Synced (and optionally Healthy), use:
Example output when the app is Synced and Healthy:

Common Argo CD CLI commands

References and further reading

Conclusion

Everything you can manage in the Argo CD UI is also available via the CLI: creating applications, syncing, enabling automated sync/self-heal/auto-prune, and monitoring application/resource status. The CLI provides the same control and visibility in a scriptable form, making it ideal for automation and CI/CD pipelines.

Watch Video

Practice Lab