---
title: Step‑by‑Step Guide to Automating Kubernetes Deployments with Argo CD
siteUrl: https://logzly.com/devopschronicle
author: devopschronicle (The DevOps Chronicle)
date: 2026-06-16T15:22:22.802382
tags: [devops, kubernetes, argocd]
url: https://logzly.com/devopschronicle/stepbystep-guide-to-automating-kubernetes-deployments-with-argo-cd
---


**Disclosure: We are reader supported, and earn affiliate commissions when you buy through us.**


You’ve probably felt the rush of a new feature landing in production, followed by the dread of “Did the rollout break something?”  In today’s fast‑moving world, that anxiety is a waste of time. Argo CD lets you turn a manual, error‑prone deployment into a repeatable, safe process that runs itself. Below is the exact path I follow when I bring Argo CD into a team that already lives in Kubernetes.

## Why Argo CD Makes Sense Right Now

Kubernetes already gives us a powerful platform, but it does not give us a built‑in way to keep the cluster in sync with the code we store in Git. That gap is where Argo CD shines. It treats your Git repository as the single source of truth and continuously applies any changes to the cluster. The result is:

* **Visibility** – you can see exactly what version is running.
* **Safety** – every change is versioned, so you can roll back with a single click.
* **Speed** – no more waiting for a teammate to run `kubectl apply` by hand.

I first tried Argo CD on a small side project. Within a day the whole team stopped fighting over “who applied the latest yaml?” and started focusing on building features. That experience convinced me that any serious DevOps team should have it in their toolbox.

## Prerequisites

Before we dive in, make sure you have:

* A Kubernetes cluster (any cloud or on‑prem works).
* `kubectl` configured to talk to that cluster.
* A Git repository that holds your Kubernetes manifests or Helm charts.
* A machine with `helm` and `argocd` CLI installed – I usually run these from my laptop.

If any of these are missing, pause and get them set up first. Trying to skip steps only leads to frustration later.

## Installing Argo CD

### 1. Deploy the Argo CD control plane

Run the following command in the namespace you want [Argo CD control plane](/devopschronicle/stepbystep-guide-to-automating-kubernetes-deployments-with-argo-cd) to live in (I like `argocd`):

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

This pulls a set of manifests that create the server, repo server, and UI components. The whole stack is ready in a couple of minutes.

### 2. Expose the UI

For a quick test I use port‑forwarding:

```bash
kubectl port-forward svc/argocd-server -n argocd 8080:443
```

Now you can open `http://localhost:8080` in a browser. The default admin password is the pod name of the `argocd-server` pod – you can fetch it with:

```bash
kubectl -n argocd get pod -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f2
```

Log in, change the password, and you’re ready to go.

## Connecting Argo CD to Your Git Repo

### 3. Add a repository

In the UI click **Settings → Repositories → Connect Repo**. Fill in the URL, choose HTTPS or SSH, and add any needed credentials. I always use a read‑only deploy key so the CI pipeline can’t accidentally push changes back.

If you prefer the CLI, run:

```bash
argocd repo add https://github.com/yourorg/yourrepo.git --username youruser --password yourtoken
```

### 4. Create an Application

An *Application* in Argo CD is a mapping between a Git path and a target namespace in the cluster.

```bash
argocd app create my‑app \
  --repo https://github.com/yourorg/yourrepo.git \
  --path manifests \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production \
  --sync-policy automated
```

Key flags explained:

* `--repo` – the Git repo we added earlier.
* `--path` – folder inside the repo that holds the manifests.
* `--dest-namespace` – where the resources will be applied.
* `--sync-policy automated` – tells Argo CD to auto‑sync whenever it sees a change.

## Making the Deployment Truly Automated

### 5. Enable health checks

Argo CD can wait until a pod is ready before marking a sync as successful. Add a `healthChecks` block to the `argocd-cm` ConfigMap or simply enable it in the UI under **App Settings → Auto‑Sync → Prune** and **Self‑Heal**. This ensures that a bad image won’t silently stay in the cluster.

### 6. Add a Helm chart (optional)

If you prefer Helm over raw yaml, point `--path` at the chart directory and add `--helm-set` flags as needed. Argo CD will render the chart on the fly, so you keep all versioning in Git.

```bash
argocd app create my‑helm‑app \
  --repo https://github.com/yourorg/helm‑repo.git \
  --path charts/my‑service \
  --helm-set image.tag=1.2.3 \
  --dest-namespace staging \
  --sync-policy automated
```

### 7. Hook it into your CI pipeline

The magic happens when a CI job pushes a new commit, similar to deploying a [zero-downtime CI/CD pipeline](/devopschronicle/step-by-step-guide-to-building-a-zerodowntime-ci-cd-pipeline-on-aws-with-github-actions) on AWS. In my Jenkinsfile I add a simple step:

```groovy
sh "git push origin HEAD:main"
sh "argocd app sync my-app"
```

Because the app is already set to auto‑sync, the extra `argocd app sync` is optional, but it gives an immediate [feedback loop](https://www.amazon.com/s?k=Feedback+Loop&tag=organizationtip101-20). If the sync fails, the CI job can mark the build as red, alerting the team right away.

## Observing and Troubleshooting

### 8. Use the UI for quick checks

The Argo CD UI shows a clear diff between what’s in Git and what’s live. Green means everything matches, red means drift. Clicking a resource opens its logs and events, which is a lifesaver when a pod crashes after a rollout.

### 9. Enable notifications

Argo CD can send Slack or [email alerts](https://www.amazon.com/s?k=email+alerts&tag=organizationtip101-20) on sync failures. I add a small `argocd-notifications-cm` ConfigMap with a webhook URL. Once set, the whole team gets a ping the moment something goes wrong, and we can roll back before users notice.

## Best Practices I Live By

* **Keep manifests small** – split them by service or environment. Smaller diffs are easier to review.
* **Never store secrets in plain text** – use Sealed Secrets or external secret managers and reference them in the manifests.
* **Lock down the Argo CD service account** – give it only the permissions it needs (usually `edit` on the target namespace).
* **Tag your releases** – use Git tags like `v1.4.0` and point Argo CD to a tag instead of `main` for production. This adds an extra [safety net](https://www.amazon.com/s?k=safety+net&tag=organizationtip101-20).

## Wrapping Up

Automating Kubernetes deployments with Argo CD is less about learning a new tool and more about adopting a mindset where Git truly drives the state of your cluster. Once you have the control plane installed, the repo linked, and the application defined, the rest is just a matter of letting the system do the [heavy lifting](https://www.amazon.com/s?k=heavy+lifting&tag=organizationtip101-20), allowing you to explore other [ready-to-use automation scripts](/devopschronicle/10-readytouse-automation-scripts-that-cut-release-time-in-half-for-small-devops-teams) for your small DevOps team. The result? Faster releases, fewer human errors, and a team that can actually enjoy building software instead of firefighting deployments.
