Skip to main content

Argo CD CLI Basics – From Zero to Managing Apps

This document assumes:
  • Argo CD is already installed in the cluster
  • You have kubectl access
  • You are using the Argo CD CLI (argocd)

1. Install Argo CD CLI

macOS

Linux

Verify:

2. Access Argo CD Server

Most clusters expose Argo CD as ClusterIP, so you must port-forward.
Argo CD is now reachable at:

3. Get Initial Admin Password

Save it. You’ll need it once.

4. Login Using Argo CD CLI

Why --insecure?
  • Argo uses a self-signed cert by default.
  • Without it, CLI login fails.
Verify login:
If this fails, nothing else will work. Stop here and fix login first.

5. Repository Management (Git)

List repositories


Add a Git repository (HTTPS)

⚠️ Never use real account password. Always use app password / token.
Requirements:
  • Private key has no passphrase (or provide one)
  • Public key added to repo access keys in Git provider
  • Repo URL must be SSH (git@...)

Remove a repository


Get repository details

Use this when “Connected” lies to you.

6. Application Basics

An Application = Git repo + path + cluster + namespace.

List applications


Create an application (imperative)

Key flags explained:
  • --repo → Git repository
  • --path → Folder inside repo
  • --dest-server → Target cluster
  • --dest-namespace → Target namespace
  • --sync-policy automated → Auto-sync (optional)

Create app without auto-sync (manual control)


7. Syncing Applications

Manual sync


Refresh app state (re-fetch Git)

This is mandatory after:
  • Repo credential changes
  • Branch/tag changes
  • Repo-server restarts

Force sync (dangerous but sometimes needed)

This will:
  • Recreate resources
  • Overwrite drift
  • Potentially cause downtime
Use sparingly.

8. Application Inspection & Debugging

Get app details


View app history


Rollback to a previous revision


Delete an application

Add --cascade to delete cluster resources too:

9. Cluster Management

List clusters known to Argo CD


Add current cluster

Example:

10. Common Operational Commands

Restart repo-server (Git issues)


Restart application controller


Check Argo CD components


11. Mental Model (Important)

  • Argo CD does not continuously validate repo auth
  • “Connected” ≠ “Can fetch”
  • git fetch failure = broken auth
  • SSH issues are almost always key placement or repo URL mistakes
  • CLI errors > UI indicators

Strong Opinion (earned from pain)

If this is a real environment:
  • ✅ Use SSH deploy keys
  • ✅ Use service accounts
  • ❌ Avoid personal credentials
  • ❌ Avoid trusting UI status

If you want next:
  • ApplicationSet CLI usage
  • Multi-env repo structure (dev/stage/prod)
  • How Argo CD actually stores repo credentials (secrets)
  • Hardening Argo CD for production
Say the word and I’ll go straight into it.