Guide to creating and syncing an Argo CD application entirely via the argocd CLI, including installation, login, app creation, namespace setup, synchronization, and troubleshooting
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:
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.
First, try listing applications. If you’re not logged in or the CLI can’t reach the server, this will fail:
Copy
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:
Copy
# If you don't have the alias `k`, use kubectlkubectl -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):
Copy
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:
Copy
'admin:login' logged in successfullyContext 'localhost:31148' updated
Now retry:
Copy
argocd app list
Example output for one existing app:
Copy
NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGETargocd/highway-animation https://kubernetes.default.svc highway-animation default Synced Healthy Manual <none> http://host.docker.internal:5000/kk-org/capa-demos ./vanilla HEAD
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.