Skip to main content
In this guide you’ll learn how to create an Argo CD application entirely from the command line and synchronize it to a Kubernetes cluster using the argocd CLI. Follow these steps:
  • Install the argocd CLI
  • Authenticate (log in) to your Argo CD server
  • List existing applications
  • Create a new application with the CLI
  • Create the target namespace (if necessary)
  • Synchronize the application and verify status
For background reading, see the Argo CD documentation: Argo CD Docs and the Kubernetes docs: Kubernetes Concepts.

1. Install the argocd CLI

Choose the installation method that matches your OS. The following table summarizes common options.
PlatformInstallation
Arch Linuxpacman -S argocd
macOS (Homebrew)brew install argocd
Linux (direct download, amd64)Download and install binary (example below)
Specific releaseDownload the desired release from GitHub
Example direct download (Linux amd64):
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
To install a specific release, replace latest with the release tag:
VERSION=<TAG> # pick a release tag from https://github.com/argoproj/argo-cd/releases
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
Verify the client version:
argocd version
Example client-only output:
argocd: v3.1.5+cfed49
BuildDate: 2025-09-10T16:01:20Z
GitCommit: cfed4910542c359f18537a6668d4671abd3813b
GitTreeState: clean
GoVersion: go1.24.6
Compiler: gc
Platform: linux/amd64
A dark-themed Visual Studio Code window with the integrated terminal displaying the Argo CD CLI help output (a list of available commands and flags). The Explorer sidebar is visible on the left and a faint Argo CD/VS Code logo appears in the editor area.
If the CLI cannot reach the Argo CD API server, commands that contact the server (e.g., argocd app list) will return a connection error. You must log in before managing applications.

2. Log in to the Argo CD server

First, try listing applications. If you’re not logged in or the CLI can’t reach the server, this will fail:
argocd app list
If you get an error such as “Failed to establish connection … connection refused”, confirm the argocd-server service and its NodePort or load balancer address. Find the argocd server service in the argocd namespace:
# If you don't have the alias `k`, use kubectl
kubectl -n argocd get svc
Note the NodePort (example: 31148) or external IP. Then log in with the CLI, replacing <NODEPORT> with the correct host:port (e.g., localhost:31148):
argocd login localhost:31148
The login flow may prompt:
  • A TLS certificate verification warning (if the server uses a self-signed cert)
  • Username (commonly admin unless changed)
  • Password
If the server uses a self-signed certificate, argocd will warn that the certificate is signed by an unknown authority. You can proceed insecurely by answering y to the prompt, but for production environments configure TLS correctly to avoid security risks.
On successful login you should see:
'admin:login' logged in successfully
Context 'localhost:31148' updated
Now retry:
argocd app list
Example output for one existing app:
NAME                      CLUSTER                         NAMESPACE          PROJECT  STATUS  HEALTH   SYNCPOLICY  CONDITIONS  REPO                                              PATH       TARGET
argocd/highway-animation  https://kubernetes.default.svc  highway-animation  default  Synced  Healthy  Manual      <none>      http://host.docker.internal:5000/kk-org/capa-demos  ./vanilla  HEAD

3. Create a new application using the CLI

Create a new application (app-2) that points to the same repository and path as the existing app but targets a different namespace (app-2):
argocd app create app-2 \
  --repo http://host.docker.internal:5000/kk-org/capa-demos \
  --path ./vanilla \
  --dest-namespace app-2 \
  --dest-server https://kubernetes.default.svc
Expected response:
application 'app-2' created
List applications again:
argocd app list
Because the repository path is shared with another application, Argo CD may report shared resources and mark the new app as OutOfSync. Example output:
NAME                       CLUSTER                         NAMESPACE  PROJECT  STATUS     HEALTH   SYNCPOLICY   CONDITIONS                      REPO                                              PATH
argocd/app-2               https://kubernetes.default.svc  app-2      default  OutOfSync  Healthy  Manual       SharedResourceWarning(2)         http://host.docker.internal:5000/kk-org/capa-demos  ./vanilla
argocd/highway-animation   https://kubernetes.default.svc  highway-animation  default  Synced  Healthy  Manual   <none>                       http://host.docker.internal:5000/kk-org/capa-demos  ./vanilla  HEAD

4. Create the destination namespace (if needed)

If the destination namespace app-2 does not exist, create it with kubectl:
kubectl create ns app-2
# namespace/app-2 created

5. Synchronize the application

Sync the newly created application to apply the manifests to the cluster:
argocd app sync app-2
During sync the CLI prints resource-level events and a summary. Example output:
TIMESTAMP                           GROUP   KIND        NAMESPACE  NAME                          STATUS     HEALTH    HOOK  MESSAGE
2025-10-23T10:32:26+00:00           v1      Service     app-2      highway-animation-service      OutOfSync  Healthy
2025-10-23T10:32:26+00:00           apps    Deployment  app-2      highway-animation              OutOfSync  Healthy
2025-10-23T10:32:27+00:00           v1      Service     app-2      highway-animation-service      Synced     Healthy   service/highway-animation-service configured
2025-10-23T10:32:28+00:00           apps    Deployment  app-2      highway-animation              Synced     Healthy   deployment.apps/highway-animation configured

Name:        argocd/app-2
Project:     default
Server:      https://kubernetes.default.svc
Namespace:   app-2
URL:         https://localhost:31148/applications/app-2
Source:
- Repo: http://host.docker.internal:5000/kk-org/capa-demos
  Path: ./vanilla
SyncWindow:  Sync Allowed
Sync Policy: Manual
Sync Status: Synced to (0c48696)
Health Status: Healthy
After the sync completes the application should appear as Synced / Healthy. Verify via the UI or with:
argocd app list

Troubleshooting and best practices

  • Use unique resource names and namespaces when multiple Argo CD applications reference the same repository to avoid SharedResourceWarning.
  • Prefer overlays, separate paths, or separate repositories when deploying distinct environments.
  • For production, configure proper TLS certificates rather than accepting self-signed certificates.
If multiple Argo CD applications point to the same manifests and overlap resources (same names/namespaces), Argo CD raises SharedResourceWarning. Avoid conflicts by using distinct repository paths, kustomize overlays, or separate namespaces and repositories.
This completes the demo for creating and synchronizing an Argo CD application using the CLI. For more examples and advanced workflows, see the Argo CD CLI reference.

Watch Video