Modern DevOps teams are moving away from manual Kubernetes deployments and embracing GitOps for faster, safer, and more reliable application delivery. One of the most popular GitOps tools today is Argo CD.
In this guide, you’ll learn how to deploy your first application using Argo CD on Kubernetes. By the end of this tutorial, you’ll understand:
- What Argo CD is
- How GitOps works
- How to install Argo CD
- How to connect a Git repository
- How to deploy an application
- How synchronization and self-healing work
- Best practices for production usage
Official resources:
Table of Contents
ToggleWhat Is Argo CD?
Argo CD is a declarative GitOps continuous delivery tool for Kubernetes.
Instead of manually applying Kubernetes manifests using kubectl apply, Argo CD continuously monitors a Git repository and automatically syncs the desired state to your Kubernetes cluster.
In simple terms:
- Git repository = Source of truth
- Argo CD = Deployment automation engine
- Kubernetes = Runtime environment
Whenever changes are pushed to Git, Argo CD detects them and deploys the updated configuration to Kubernetes.
This approach improves:
- Deployment consistency
- Auditability
- Rollback capability
- Security
- Team collaboration
Understanding GitOps
GitOps is an operational framework that uses Git repositories as the single source of truth for infrastructure and applications.
Traditional deployment flow:
Developer → CI/CD Pipeline → KubernetesGitOps deployment flow:
Developer → Git Repository → Argo CD → KubernetesBenefits of GitOps include:
- Version-controlled deployments
- Easy rollback using Git commits
- Reduced manual intervention
- Automated synchronization
- Better disaster recovery
Argo CD is one of the leading tools enabling GitOps for Kubernetes.
Prerequisites
Before starting, ensure you have:
- A Kubernetes cluster
- kubectl installed
- Access to a Git repository
- Basic Kubernetes knowledge
You can use:
- Minikube
- Kind
- Amazon EKS
- Google GKE
- Azure AKS
For this tutorial, any Kubernetes cluster will work.
Step 1: Install Argo CD
First, create a namespace for Argo CD.
kubectl create namespace argocdNow install Argo CD using the official manifests.
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yamlThis command installs:
- Argo CD API server
- Repository server
- Controller
- Redis
- UI components
Verify the pods are running:
kubectl get pods -n argocdYou should see multiple pods in the Running state.
Step 2: Access the Argo CD UI
Expose the Argo CD API server using port forwarding.
kubectl port-forward svc/argocd-server -n argocd 8080:443Now open:
https://localhost:8080Ignore the self-signed certificate warning.
Step 3: Get the Admin Password
Retrieve the initial admin password.
kubectl get secret argocd-initial-admin-secret -n argocd \ -o jsonpath=”{.data.password}” | base64 -dLogin credentials:
Username: admin Password:After logging in, you’ll see the Argo CD dashboard.
Step 4: Create a Git Repository
Argo CD deploys applications directly from Git repositories.
Create a Git repository structure like this:
my-app/
├── deployment.yaml
├── service.yaml
└── namespace.yamlExample deployment manifest:
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-app spec: replicas: 2 selector: matchLabels: app: nginx-app template: metadata: labels: app: nginx-app spec: containers: – name: nginx image: nginx:latest ports: – containerPort: 80Example service manifest:
apiVersion: v1 kind: Service metadata: name: nginx-service spec: selector: app: nginx-app ports: – port: 80 targetPort: 80Push these manifests to GitHub or another Git provider.
Step 5: Create an Application in Argo CD
Now it’s time to deploy your application.
You can create applications using:
- UI
- CLI
- YAML manifests
We’ll use the UI for simplicity.
In the Argo CD dashboard:
- Click NEW APP
- Fill in:
- Application Name
- Project: default
- Sync Policy: Manual
- Repository URL
- Path to manifests
- Cluster URL
- Namespace
Example:
Application Name: nginx-app Repository URL: https://github.com/your-repo/my-app.git Path: . Cluster URL: https://kubernetes.default.svc Namespace: defaultClick Create.
Argo CD now tracks your Git repository.
Step 6: Sync the Application
After creating the application, Argo CD compares:
- Desired state in Git
- Actual state in Kubernetes
Initially, the application status will show:
OutOfSyncThis means Kubernetes resources are not yet deployed.
Click SYNC → SYNCHRONIZE.
Argo CD applies the manifests automatically.
After successful deployment, the status changes to:
Healthy
SyncedCongratulations your first Argo CD deployment is complete.
Step 7: Verify the Deployment
Check the Kubernetes resources.
kubectl get deployments kubectl get services kubectl get podsYou should see:
- Running pods
- Active deployment
- Service exposed
You can also inspect resources directly from the Argo CD UI.
Step 8: Update the Application
One of the biggest advantages of GitOps is automated updates.
Modify the deployment manifest:
replicas: 3Commit and push the change:
git add . git commit -m “Scale application” git pushArgo CD detects the Git change automatically.
The application becomes:
OutOfSyncClick Sync again.
Argo CD updates the Kubernetes deployment without manual kubectl commands.
Understanding Auto Sync
Manual synchronization works well for learning environments.
In production, teams often enable automatic synchronization.
Benefits:
- Faster deployments
- Reduced operational overhead
- Fully automated GitOps workflow
Enable auto-sync using the UI or YAML.
Example:
syncPolicy: automated: prune: true selfHeal: trueFeatures:
prune: Removes unused resourcesselfHeal: Restores drifted resources automatically
Self-Healing in Argo CD
Self-healing is one of Argo CD’s most powerful features.
Suppose someone manually changes a deployment in Kubernetes.
Argo CD detects that the cluster no longer matches Git and automatically restores the desired configuration.
This prevents:
- Configuration drift
- Unauthorized changes
- Environment inconsistencies
Git always remains the single source of truth.
Rollbacks Made Easy
Traditional Kubernetes rollbacks can be complex.
With Argo CD and GitOps:
- Every deployment is version-controlled
- Every commit becomes recoverable
To rollback:
- Revert the Git commit
- Push the changes
- Sync the application
Argo CD restores the previous working version.
This makes deployments significantly safer.
Argo CD CLI Basics
Argo CD also provides a powerful CLI.
Install CLI:
Login:
argocd login localhost:8080List applications:
argocd app listSync an application:
argocd app sync nginx-appGet application details:
argocd app get nginx-appThe CLI is extremely useful for automation and scripting.
Best Practices for Using Argo CD
1. Use Separate Environments
Maintain:
- dev
- staging
- production
using separate namespaces or clusters.
2. Protect the Main Branch
Since Git controls deployments:
- Use pull requests
- Enable approvals
- Enforce branch protection
3. Store Secrets Securely
Never commit secrets directly into Git.
Use:
- HashiCorp Vault
- Sealed Secrets
- External Secrets Operator
4. Use Helm or Kustomize
Argo CD supports:
- Helm
- Kustomize
- Jsonnet
These tools improve scalability and reusability.
5. Enable RBAC
Restrict access based on roles:
- Developers
- Operators
- Administrators
This improves security in enterprise environments.
Common Troubleshooting Tips
Application Stuck in OutOfSync
Possible causes:
- Incorrect repository path
- YAML errors
- Cluster connectivity issues
Check:
argocd app logsRepository Authentication Failed
For private repositories:
- Configure SSH keys
- Use Git access tokens
Pods Not Starting
Inspect pod logs:
kubectl logsWhy DevOps Teams Love Argo CD
Argo CD simplifies Kubernetes deployments by combining:
- Automation
- Git-based workflows
- Visibility
- Security
- Reliability
It reduces operational complexity while improving deployment consistency.
Organizations adopting Kubernetes at scale often choose Argo CD because it:
- Supports GitOps natively
- Integrates well with CI pipelines
- Improves rollback and recovery
- Encourages infrastructure-as-code practices
Final Thoughts
Argo CD has become one of the most important tools in the Kubernetes ecosystem. By adopting GitOps principles, teams can automate deployments, reduce errors, and improve operational reliability.
In this tutorial, you learned how to:
- Install Argo CD
- Connect a Git repository
- Deploy an application
- Sync Kubernetes resources
- Enable automated GitOps workflows
Once you understand the basics, you can explore advanced topics like:
- Multi-cluster management
- Helm integration
- ApplicationSets
- Progressive delivery
- Argo Rollouts
If you’re serious about Kubernetes and modern DevOps practices, learning Argo CD is a valuable investment.



