DEV Community

Cover image for GitOps & Argo CD: A Complete Introduction.
Vijesh Nair for CareerByteCode

Posted on

GitOps & Argo CD: A Complete Introduction.

A hands-on developer-focused introduction to GitOps and Argo CD. Learn how GitOps works, why it matters, and how to deploy your first Kubernetes application using Argo CD with examples, diagrams, and real-world use cases.


πŸ“‘ Table of Contents

  1. What Is GitOps?
  2. Why GitOps Matters for Developers
  3. Core Principles of GitOps
  4. Argo CD Overview & Architecture
  5. Installing Argo CD
  6. Deploying Your First Application with Argo CD
  7. Real-World GitOps Use Cases
  8. Common Developer Questions
  9. Related Tools & Libraries
  10. Conclusion + Call to Action
  11. SEO Keywords
  12. Suggested Dev.to Tags
  13. Canonical Link Notice
  14. Cover Image

What Is GitOps?

GitOps is an operational model where Git becomes the single source of truth for describing infrastructure and application state. Instead of pushing changes directly to Kubernetes, developers push configuration changes to Git, and an automated system continuously reconciles the current cluster state with what’s declared in the repo.

Simply put:

If it’s in Git β†’ It should exist in the cluster.
If it’s not in Git β†’ It should not exist in the cluster.

GitOps combines:

  • Git
  • Kubernetes
  • Declarative configuration
  • Continuous reconciliation

Why GitOps Matters for Developers

GitOps solves common DevOps pain points:

πŸ”Ή 1. Full Visibility

Every change is visible, reviewed, and documented in Git.

πŸ”Ή 2. Faster, Safer Deployments

Rollback = revert a Git commit.

πŸ”Ή 3. No More β€œWhat Changed in Production?”

Infrastructure drift disappears.

πŸ”Ή 4. Developers Don’t Need kubectl Access

Security improves while productivity stays high.

πŸ”Ή 5. Consistent Multi-Environment Deployments

Perfect for microservices, staging clusters, and multi-region setups.


Core Principles of GitOps

βœ”οΈ Declarative Definitions

All infrastructure and app manifests live as code.

βœ”οΈ Versioned & Immutable

Git provides built-in history, approvals, and audit trails.

βœ”οΈ Continuous Reconciliation

A controller checks for drift and fixes it automatically.

βœ”οΈ Self-Healing

If someone manually changes a Deployment, the GitOps controller resets it.


Argo CD Overview & Architecture

Argo CD is a declarative GitOps controller for Kubernetes.

It watches Git, detects configuration changes, and applies them to the cluster automatically or manually based on policy.


Argo CD High-Level Architecture

                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                           β”‚         Git Repo           β”‚
                           β”‚ (Manifests / Helm / Kustomize)
                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚
                                           β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚       Argo CD             β”‚
                            β”‚  API Server + UI + CLI    β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                                    β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚ Repo Server   β”‚                    β”‚ Application Ctrlβ”‚
            β”‚ - Fetches Git β”‚                    β”‚ - Sync engine   β”‚
            β”‚ - Renders     β”‚                    β”‚ - Health checks β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚                                    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   Applies Manifests
                                          β”‚
                                          β–Ό
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚ Kubernetes Cluster   β”‚
                               β”‚ (Actual State)       β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Installing Argo CD

Step 1 : Create namespace

kubectl create namespace argocd
Enter fullscreen mode Exit fullscreen mode

Step 2 : Install Argo CD

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

Step 3 : Check ArgoCD components installed

kubectl -n argocd get all
Enter fullscreen mode Exit fullscreen mode

Step 4 : Retrieve admin password

kubectl get secret argocd-initial-admin-secret -n argocd \
  -o jsonpath="{.data.password}" | base64 -d
Enter fullscreen mode Exit fullscreen mode

Step 5 : Access the UI

kubectl port-forward svc/argocd-server -n argocd 8080:443
Enter fullscreen mode Exit fullscreen mode

Open:

https://localhost:8080
Enter fullscreen mode Exit fullscreen mode

Login as:

username: admin
password: <the password above>
Enter fullscreen mode Exit fullscreen mode


Deploying Your First Application with Argo CD

Let’s deploy a real Kubernetes app using an Argo CD Application resource.

1. Create an Argo CD Application manifest

guestbook-app.yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps
    targetRevision: HEAD
    path: guestbook
  destination:
    server: https://kubernetes.default.svc
    namespace: default
  syncPolicy:
    automated:
      selfHeal: true
      prune: true
Enter fullscreen mode Exit fullscreen mode

2. Apply it

kubectl apply -f guestbook-app.yaml
Enter fullscreen mode Exit fullscreen mode

Argo CD will:

  • Fetch code from Git
  • Render YAML
  • Compare with live cluster
  • Deploy the manifests
  • Continuously watch for drift


Real-World GitOps Use Cases

πŸš€ 1. Multi-Environment Promotion

/environments/dev
/environments/test
/environments/prod
Enter fullscreen mode Exit fullscreen mode

Promote via Git PRs instead of manual deploys.

🧩 2. Microservices at Scale

Each app = one Argo CD Application.
Perfect for teams with 10–200+ microservices.

πŸ”„ 3. Automatic Rollbacks with Git

Revert the commit β†’ Argo CD syncs.

πŸ” 4. More Secure Deployments

Teams remove direct kubectl access for developers.

πŸ“¦ 5. Helm + Kustomize Deployments

Argo CD handles both seamlessly.


Developer Tips

  • Use App of Apps pattern for large clusters.
  • Use health checks to fail early.
  • Enable selfHeal to auto-correct cluster drift.
  • Use sync waves for ordering complex deployments.
  • Store secrets using SOPS or Sealed Secrets.

Common Developer Questions

1. Does GitOps replace CI/CD?

No. CI builds artifacts. GitOps handles deployments.

2. Can I use Helm charts with Argo CD?

Yes -> native support.

3. How does Argo CD detect drift?

It continuously compares the live cluster state with what’s in Git.

4. Can Argo CD deploy to multiple clusters?

Yes, easily.

5. How do I manage secrets?

Use:

  • SOPS
  • Sealed Secrets
  • External Secrets Operator

6. Do I need to give developers kubectl access?

Not anymore -> GitOps removes the need.


Related Tools & Libraries

GitOps Tools

  • Argo CD
  • Flux CD

Template Tools

  • Helm
  • Kustomize
  • Jsonnet

Secrets Management

  • Mozilla SOPS
  • Bitnami Sealed Secrets
  • HashiCorp Vault

CI Tools (Pair with GitOps)

  • GitHub Actions
  • GitLab CI
  • Jenkins
  • Argo Workflows

Conclusion

GitOps and Argo CD bring reliability, visibility, and automation to Kubernetes operations.
If your team uses Kubernetes, adopting GitOps is one of the fastest ways to improve release safety and developer productivity.

πŸ‘‰ If you found this tutorial useful and want to stay updated on GitOps, Argo CD, Kubernetes, DevOps, AI and cloud engineering topics feel free to connect with me on:

linkedin.com/in/vjcloudops
vjcloudops.medium.com


Hope this is insightful...
Thanks for reading...

If you find this useful do like and subscribe for more updates on this series !!!

Top comments (0)