Your First ArgoCD Application

Deploying My First App with ArgoCD (And Understanding What Happened)

After installing ArgoCD, I was eager to deploy something. I found a tutorial:

argocd app create my-app \
  --repo https://github.com/mycompany/my-app-config.git \
  --path manifests \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production

It worked! Sort of. The app showed up in ArgoCD UI as "OutOfSync". I clicked "Sync" and it deployed.

But I had questions:

  • What did that command actually create?

  • Why was it OutOfSync?

  • What's the difference between manual and auto-sync?

  • How does ArgoCD know if my app is healthy?

  • What if I want to change the deployment?

Let me walk you through creating your first ArgoCD application properly, understanding every step.

What Is an ArgoCD Application?

An Application is a Kubernetes Custom Resource (CRD) that tells ArgoCD:

  1. Where to get manifests (Git repo)

  2. What manifests to deploy (path in repo)

  3. Where to deploy them (cluster + namespace)

  4. How to deploy them (sync policy, health checks)

It's the core concept in ArgoCD.

Preparing Your Git Repository

First, you need a Git repo with Kubernetes manifests.

Create a Simple Git Repo

Repository structure:

Method 1: Creating Application via CLI

Parameter breakdown:

  • --repo: Git repository URL

  • --path: Path within repo (. = root)

  • --dest-server: Target Kubernetes cluster (use kubernetes.default.svc for the cluster where ArgoCD runs)

  • --dest-namespace: Target namespace

  • --revision: Git branch/tag/commit (default: HEAD)

Check application status:

Status explanation:

  • Sync Status: OutOfSync - Git state β‰  Cluster state (nothing deployed yet)

  • Health Status: Missing - Resources don't exist in cluster

Method 2: Creating Application via YAML

This is more GitOps-friendly (store Application definition in Git).

Advantage: Application definition is version-controlled and declarative.

Method 3: Creating Application via Web UI

  1. Open ArgoCD UI

  2. Click "+ NEW APP"

  3. Fill in form:

    • Application Name: nginx-app

    • Project: default

    • Sync Policy: Manual

    • Repository URL: https://github.com/yourusername/my-app-manifests.git

    • Revision: main

    • Path: .

    • Cluster URL: https://kubernetes.default.svc

    • Namespace: default

  4. Click "CREATE"

Advantage: Visual, good for learning and one-off deployments.

Syncing Your Application

After creating the application, it's OutOfSync (not deployed).

Manual Sync

Or via UI:

  1. Click on application

  2. Click "SYNC"

  3. Click "SYNCHRONIZE"

Or via kubectl:

Verify Deployment

Status now:

  • Sync Status: Synced - Git state = Cluster state βœ“

  • Health Status: Healthy - All resources running βœ“

Understanding the Application CRD

Let's look at the actual Application resource:

Key fields:

  • spec.source: Git repo details

  • spec.destination: Target cluster/namespace

  • status.sync.status: Synced or OutOfSync

  • status.health.status: Healthy, Progressing, Degraded, Missing

  • status.resources: List of all managed resources

Auto-Sync: The GitOps Magic

Manual sync requires clicking "Sync" every time you push to Git. Auto-sync automates this.

Enabling Auto-Sync

Or via CLI:

What happens now:

spinner

Test auto-sync:

Magic! Git push β†’ Auto-deployed.

Auto-Sync Options Explained

prune: true

What it does: Deletes resources from cluster if removed from Git.

prune: false (default):

  • Resources removed from Git stay in cluster

  • Must manually delete

selfHeal: true

What it does: Reverts manual changes to match Git.

selfHeal: false (default):

  • Manual changes stay

  • Application shows "OutOfSync"

  • Must manually sync to revert

allowEmpty: false

What it does: Prevents syncing if Git path is empty.

Use case: Avoid accidentally deleting everything if you mess up the path.

Health Assessment

ArgoCD checks if your application is healthy by evaluating each resource.

Built-in Health Checks

ArgoCD has built-in health checks for common resources:

Deployment:

Service:

Pod:

Ingress:

Custom Health Checks

You can define custom health checks:

Viewing Health in UI

ArgoCD UI shows health with visual indicators:

  • 🟒 Healthy - All resources healthy

  • 🟑 Progressing - Deployment in progress

  • πŸ”΄ Degraded - Some resources unhealthy

  • βšͺ Missing - Resources don't exist

Sync Options

Fine-tune how ArgoCD syncs your application.

CreateNamespace

Without this: Sync fails if namespace doesn't exist.

PruneLast

Use case: Avoid downtime during updates.

ApplyOutOfSyncOnly

Use case: Faster syncs, less cluster load.

Validate=false

Use case: Deploy resources that fail validation (not recommended).

ServerSideApply

Use case: Handle large resources, better conflict resolution.

Making Changes to Your Application

Let's update our application properly.

Update 1: Change Image Version

Update 2: Scale Replicas

Update 3: Add ConfigMap

Rollback

Need to rollback? Just revert in Git.

Via ArgoCD UI:

  1. Click application

  2. Click "HISTORY AND ROLLBACK"

  3. Select previous version

  4. Click "ROLLBACK"

This creates a new sync with old manifests (doesn't change Git).

Deleting an Application

Cascade options:

  • --cascade=foreground (default) - Wait for resources to delete

  • --cascade=background - Delete app immediately, resources delete async

  • --cascade=false - Delete app, keep resources

Key Takeaways

  1. Application CRD is the core

    • Defines source (Git), destination (cluster), sync policy

    • Lives in argocd namespace

    • Can create via CLI, YAML, or UI

  2. OutOfSync vs Synced

    • OutOfSync: Git β‰  Cluster

    • Synced: Git = Cluster

    • Auto-sync automates reconciliation

  3. Auto-sync enables true GitOps

    • Git push β†’ Auto-deployed

    • prune: Auto-delete removed resources

    • selfHeal: Auto-revert manual changes

  4. Health checks ensure reliability

    • Built-in checks for common resources

    • Custom checks for CRDs

    • Visual indicators in UI

  5. Git is the source of truth

    • Want to update? Commit to Git

    • Want to rollback? Revert Git commit

    • Want to see what's deployed? Check Git

In the next article, we'll explore using Kustomize and Helm with ArgoCD to manage multi-environment deployments (dev, staging, production) from a single Git repo.


Previous: Installing and Configuring ArgoCD Next: Kustomize and Helm with ArgoCD

Last updated