Skip to main content
This lesson demonstrates how to perform Argo CD application lifecycle operations using the Argo CD CLI instead of the web UI. You’ll learn how to:
  • Log in to the Argo CD server from the CLI
  • Create an application from a Git repository
  • Perform a manual sync and inspect status
  • Enable automated sync, self-heal, and auto-prune
  • Verify self-healing by making an intentional out-of-band change
This is a lab environment: TLS is not configured and plaintext credentials are used for demonstration only. Do not use these options in production.
This lesson uses an insecure CLI login with plaintext credentials for demonstration only. Do not use --insecure or --plaintext in production.
Prerequisites: the argocd CLI and kubectl must be installed and configured to talk to the target cluster where Argo CD is running. The sample app repository used in this lesson is https://github.com/argoproj/argocd-example-apps.git.

Quick reference: key commands


1) Log in to Argo CD via CLI

In this lab Argo CD is exposed on a NodePort at localhost:3000. Log in using the argocd CLI:
Example successful output:
Tip: In production use TLS and a secure authentication method (SSO, OIDC, or client certificates). See the Argo CD docs for recommended authentication setups.

2) Create the application from the CLI

Create the web-frontend application using the sample guestbook app repository:
Example confirmation:
By default Argo CD creates the application with Manual sync (no automatic sync). Check the application status:
Representative output (trimmed):
At this point the applications namespace has no resources managed by Argo CD:
Output:

3) Sync the application

Perform a manual sync to apply the manifests from Git into the cluster:
Example (trimmed) sync output:
Re-check the application status:
Now the app should report Synced and Healthy (or briefly Progressing while the Deployment becomes ready):
Confirm pods are running in the applications namespace:
Example:

4) Enable automated sync and self-heal

To make the application automatically reconcile differences and prune deleted resources, switch the sync policy to Automated and enable self-heal and auto-prune: Set automated sync policy:
Enable self-heal (revert out-of-band cluster changes) and auto-prune (remove resources deleted from Git):
Verify the application sync policy and sync options:
Representative output:
You can view available sync flags with argocd app set --help. Example sync-related flags include:

5) Demonstrate self-heal by scaling the Deployment

To verify self-healing works, simulate an out-of-band change by scaling the guestbook-ui Deployment to 5 replicas:
Then observe app status and pods:
Argo CD will detect the divergence (cluster state != Git desired state) and automatically reconcile the cluster to the Git-declared state. After reconciliation the Deployment should revert to the desired replica count defined in Git. Example status after reconciliation:
Pod list after auto-heal:
Example:

6) Inspect Deployment events

Describe the Deployment to see events showing scale up and scale down actions. Note: when rendering MDX, literal XML/HTML-like tokens such as <none> must be written as inline code to avoid being parsed as JSX. The excerpt below uses the backticked escapes shown to ensure proper rendering.
Example (trimmed):
(Backticked <none> entries ensure MDX does not try to interpret angle-bracket content as JSX.)

7) Waiting for syncs

If a sync is in progress and you want to block until it finishes, use argocd app wait:
This command waits until the application reaches a syncable and healthy state or the timeout is reached. It exits non-zero on timeout or failure.
This completes a CLI-based workflow for creating Argo CD applications, syncing them, enabling automated reconciliation (self-heal and auto-prune), and validating self-healing behavior. For more detail and production best practices, see:

Watch Video

Practice Lab