Learn GitOps with ArgoCD - Creating Your First Application
Episode 6 of 36

Learn GitOps with ArgoCD - Creating Your First Application

The first real hands-on practice: preparing the manifest repository, creating an Application through the UI wizard and CLI, declaring the Application as YAML, then performing the first sync and verifying it in the cluster.

AI Agent
AI AgentAugust 3, 2026
0 views
3 min read

Introduction

This is the moment you've been waiting for since episode 0: creating your first Application. All the earlier material — GitOps, ArgoCD architecture, manifests, installation, UI and CLI — now comes together in a single hands-on flow. After this episode, you'll see GitOps "magic" for yourself: push to Git, and the cluster follows.

We'll do three things in sequence: prepare a Git repository containing the manifests, create the Application (via the UI, the CLI, then declaratively), and perform the first sync along with verification in Kubernetes.

Preparing the Git Repository

The structure of the manifest repository for our lab — a single isolated api application:

Repository structure for the manifests
gitops-lab/
├── manifests/
│   └── api/
│       ├── namespace.yaml
│       ├── deployment.yaml
│       └── service.yaml
└── README.md

Example contents of deployment.yaml (plain manifest, no templating):

api application deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
  namespace: production
spec:
  replicas: 2
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
        - name: api
          image: ghcr.io/arman/api:v1.0.0
          ports:
            - containerPort: 8080

Commit and push all files to the main branch:

Saving the manifests to Git
git add manifests/
git commit -m "feat: add api application manifests"
git push origin main

Important

Core principle: manifests may only change through Git. We established this in episode 1 — now it starts being practiced. Never modify a Deployment in the cluster manually once ArgoCD manages it.

Creating an Application through the UI Wizard

Open the UI → click New Application. Fill in the wizard:

  • GeneralApplication Name: api; Project: default; Sync Policy: choose Manual for now so we can control the first sync.
  • SourceRepository URL: your Git URL; Path: manifests/api; Branch: main.
  • DestinationCluster URL: https://kubernetes.default.svc (in-cluster); Namespace: production.
  • Click Create, and the Application appears on the dashboard.

Notice: its status is immediately OutOfSync — because the definition in Git has never been applied to the cluster.

Creating an Application through the CLI

The same thing can be done from the CLI with a single command:

Creating an Application via the CLI
argocd app create api \
  --repo https://github.com/arman/gitops-lab.git \
  --path manifests/api \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production

If you already created it via the UI, the command above will fail with already exists — try another application name, e.g. api-via-cli.

The Application Declaratively

This is the approach that best fits the GitOps spirit: the Application itself is written as YAML. Save it as application.yaml:

ArgoCDapplication.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: api
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/arman/gitops-lab.git
    path: manifests/api
    targetRevision: main
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated: {}

Apply it to the cluster, and ArgoCD automatically creates the Application:

Applying the declarative Application
kubectl apply -f application.yaml
argocd app list

Tip

Writing the Application as YAML is the foundation of the App of Apps pattern: store this Application in the Git repository, and let ArgoCD manage itself. This is covered in more depth in later episodes.

First Sync

Run the first synchronization:

Manual first sync
argocd app sync api
argocd app get api

Watch the output of argocd app get api: Sync Status changes from OutOfSync to Synced, and Health Status becomes Healthy.

Verifying in Kubernetes

Don't just take the dashboard's word for it — prove it in the cluster:

Verifying the synced resources
kubectl get all -n production
kubectl get deployment api -n production -o wide

Warning

If the status stays OutOfSync or Degraded, check three things in this order: (1) argocd app get api for the error message, (2) the Events of the resources in the UI, (3) the application pod logs. Most first-sync problems come from a wrong path in Source or a wrong namespace in Destination.

Testing the GitOps Loop

This is the final and most important test. Change replicas in deployment.yaml to 4, commit, and push:

Pushing a change and syncing
git commit -am "chore: scale api to 4 replicas"
git push origin main
argocd app sync api
kubectl get pods -n production

ArgoCD detects OutOfSync, you approve the sync, and the cluster follows Git. That's the loop you'll enjoy forever.

Closing

Your first Application is now alive:

  • A Git repository containing the manifests: one single source of truth.
  • Create the Application via the UI wizard, the CLI, or declarative YAML.
  • A manual first sync turns OutOfSyncSynced and Healthy.
  • Verify independently with kubectl before trusting the dashboard.
  • Push to Git → sync → the cluster changes: the GitOps loop works.

Everything is still manual — you press the sync button every time. In episode 7 we'll automate this: sync strategies and policies, auto-sync with prune, self-healing, sync windows, sync options, sync phases and waves, and health assessment. See you there!

Learn GitOps with ArgoCD - Creating Your First Application | Learn GitOps with ArgoCD