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

brew install argocd

Linux

curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
chmod +x argocd
sudo mv argocd /usr/local/bin/
Verify:
argocd version

2. Access Argo CD Server

Most clusters expose Argo CD as ClusterIP, so you must port-forward.
kubectl -n argocd port-forward svc/argocd-server 8080:443
Argo CD is now reachable at:
https://localhost:8080

3. Get Initial Admin Password

kubectl -n argocd get secret argocd-initial-admin-secret \
  -o jsonpath="{.data.password}" | base64 -d
Save it. You’ll need it once.

4. Login Using Argo CD CLI

argocd login localhost:8080 \
  --username admin \
  --password <PASSWORD> \
  --insecure
Why --insecure?
  • Argo uses a self-signed cert by default.
  • Without it, CLI login fails.
Verify login:
argocd account get-user-info
If this fails, nothing else will work. Stop here and fix login first.

5. Repository Management (Git)

List repositories

argocd repo list

Add a Git repository (HTTPS)

argocd repo add https://bitbucket.org/org/repo.git \
  --username <user> \
  --password <app-password>
⚠️ Never use real account password. Always use app password / token.
argocd repo add git@bitbucket.org:org/repo.git \
  --ssh-private-key-path ~/.ssh/argocd_id_rsa
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

argocd repo rm git@bitbucket.org:org/repo.git

Get repository details

argocd repo get git@bitbucket.org:org/repo.git
Use this when “Connected” lies to you.

6. Application Basics

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

List applications

argocd app list

Create an application (imperative)

argocd app create my-app \
  --repo git@bitbucket.org:org/repo.git \
  --path manifests \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace default \
  --sync-policy automated
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)

argocd app create my-app \
  --repo git@bitbucket.org:org/repo.git \
  --path manifests \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace default

7. Syncing Applications

Manual sync

argocd app sync my-app

Refresh app state (re-fetch Git)

argocd app refresh my-app
This is mandatory after:
  • Repo credential changes
  • Branch/tag changes
  • Repo-server restarts

Force sync (dangerous but sometimes needed)

argocd app sync my-app --force
This will:
  • Recreate resources
  • Overwrite drift
  • Potentially cause downtime
Use sparingly.

8. Application Inspection & Debugging

Get app details

argocd app get my-app

View app history

argocd app history my-app

Rollback to a previous revision

argocd app rollback my-app <REVISION_ID>

Delete an application

argocd app delete my-app
Add --cascade to delete cluster resources too:
argocd app delete my-app --cascade

9. Cluster Management

List clusters known to Argo CD

argocd cluster list

Add current cluster

argocd cluster add <kubectl-context>
Example:
argocd cluster add arn:aws:eks:ap-south-1:123456789:cluster/prod

10. Common Operational Commands

Restart repo-server (Git issues)

kubectl rollout restart deployment argocd-repo-server -n argocd

Restart application controller

kubectl rollout restart statefulset argocd-application-controller -n argocd

Check Argo CD components

kubectl get pods -n argocd

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.