Deploy Your First Application Using Argo CD

Deploy Your First Application Using Argo CD

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:

What 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 → Kubernetes

GitOps deployment flow:

Developer → Git Repository → Argo CD → Kubernetes

Benefits 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 argocd

Now install Argo CD using the official manifests.

kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

This command installs:

  • Argo CD API server
  • Repository server
  • Controller
  • Redis
  • UI components

Verify the pods are running:

kubectl get pods -n argocd

You 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:443

Now open:

https://localhost:8080

Ignore 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 -d

Login 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.yaml

Example 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: 80

Example service manifest:

apiVersion: v1 kind: Service metadata: name: nginx-service spec: selector: app: nginx-app ports: – port: 80 targetPort: 80

Push 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:

  1. Click NEW APP
  2. 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: default

Click 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:

OutOfSync

This means Kubernetes resources are not yet deployed.

Click SYNCSYNCHRONIZE.

Argo CD applies the manifests automatically.

After successful deployment, the status changes to:

Healthy
Synced

Congratulations your first Argo CD deployment is complete.

Step 7: Verify the Deployment

Check the Kubernetes resources.

kubectl get deployments kubectl get services kubectl get pods

You 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: 3

Commit and push the change:

git add . git commit -m “Scale application” git push

Argo CD detects the Git change automatically.

The application becomes:

OutOfSync

Click 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: true

Features:

  • prune: Removes unused resources
  • selfHeal: 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:

  1. Revert the Git commit
  2. Push the changes
  3. 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:8080

List applications:

argocd app list

Sync an application:

argocd app sync nginx-app

Get application details:

argocd app get nginx-app

The 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 logs

Repository Authentication Failed

For private repositories:

  • Configure SSH keys
  • Use Git access tokens

Pods Not Starting

Inspect pod logs:

kubectl logs

Why 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:

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.

shamitha
shamitha
Leave Comment
Share This Blog
Recent Posts
Get The Latest Updates

Subscribe To Our Newsletter

No spam, notifications only about our New Course updates.

Enroll Now
Enroll Now
Enquire Now