Cloud Native 13 min read

Mastering Argo CD: A Hands‑On Guide to GitOps Continuous Delivery

This article explains the concepts of GitOps and Argo CD, walks through installing Argo CD on a Kubernetes cluster, and demonstrates creating, syncing, and updating applications via the web UI, highlighting key advantages and practical commands for continuous delivery.

Ops Development Stories
Ops Development Stories
Ops Development Stories
Mastering Argo CD: A Hands‑On Guide to GitOps Continuous Delivery

Continuous deployment is a familiar term for engineers, but CI and CD are often conflated; this article separates them.

What Is Argo CD

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.

Argo CD is a declarative GitOps tool built on Kubernetes.

Before discussing Argo CD, we first need to understand GitOps.

What Is GitOps

GitOps uses Git as the source of truth and CI/CD pipelines to update applications running in cloud‑native environments, embodying the DevOps principle “you built it, you ship it”.

A diagram helps illustrate the workflow:

Developers push code to a Git repo, triggering CI to build an image and push it to a registry.

After CI, developers can manually or automatically modify application configuration and push the changes back to Git.

GitOps continuously compares the desired state in Git with the actual state in the cluster; mismatches trigger CD to apply the new configuration.

The desired state lives in Git, while the current state reflects what is running in the cluster.

Can you operate without GitOps?

Yes, you can use tools like

kubectl

or Helm directly, but this introduces a serious security risk: sharing cluster access keys with the CI system.

To enable automatic deployment, the CI system must have access to the cluster, which creates a potential security vulnerability.

Argo CD

Argo CD follows the GitOps model, storing application configurations in a Git repository.

Kubernetes manifests can be specified in several ways:

Kustomize applications

Helm charts

Ksonnet applications

Jsonnet files

YAML/JSON configuration

Any custom configuration management tool via plugins

Argo CD runs as a Kubernetes controller that continuously monitors deployed applications, comparing the live state with the desired state defined in Git. When a drift is detected (OutOfSync), Argo CD reports and visualizes the differences, offering both automatic and manual sync options. Any change committed to the Git repo is automatically applied to the target environment.

Argo CD’s position in the architecture is illustrated below:

Key advantages include:

Declarative, version‑controlled application definitions, configurations, and environment information.

Fully automated, auditable, and easy‑to‑understand application deployment and lifecycle management.

Independent deployment tool that supports unified management of applications across multiple environments and Kubernetes clusters.

Practice

Prerequisite: a functional Kubernetes cluster.

Experimental environment:

Kubernetes: 1.17.2

Argo CD: latest

Install Argo CD

Installation is straightforward; for persistence you would normally configure storage, but here we use the official quick‑start commands:

<code>kubectl create namespace argocd<br/>kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml<br/></code>

After successful execution, the

argocd

namespace contains the following resources:

<code># kubectl get all -n argocd<br/>NAME                                            READY   STATUS    RESTARTS   AGE<br/>pod/argocd-application-controller-0            1/1     Running   0          16h<br/>... (resource list omitted for brevity) ...<br/></code>

Argo CD can be accessed via two methods:

Web UI

Argo CD CLI

We use the Web UI. Change the service type to

NodePort

:

<code>kubectl edit -n argocd svc argocd-server<br/></code>

Then view the NodePort mapping:

<code># kubectl get svc -n argocd<br/>NAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                         AGE<br/>argocd-server      NodePort    10.105.229.250  <none>        80:32109/TCP,443:30149/TCP     17h<br/></code>

Access the UI at

http://<IP>:32109

:

Login with the default

admin

account; retrieve the password with:

<code>kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f2<br/></code>

Create an Application

This demo does not include a CI pipeline.

A simple GitLab repository contains a

manifests

directory with a Deployment and Service definition:

<code>apiVersion: apps/v1<br/>kind: Deployment<br/>metadata:<br/>  labels:<br/>    app: devops-argocd-test<br/>  name: devops-argocd-test<br/>  namespace: default<br/>spec:<br/>  replicas: 1<br/>  template:<br/>    metadata:<br/>      labels:<br/>        app: devops-argocd-test<br/>    spec:<br/>      containers:<br/>      - name: devops-argocd-test<br/>        image: registry.cn-hangzhou.aliyuncs.com/rookieops/argocd-test-app:v1<br/>        ports:<br/>        - containerPort: 8080<br/>---<br/>apiVersion: v1<br/>kind: Service<br/>metadata:<br/>  labels:<br/>    app: devops-argocd-test<br/>  name: devops-argocd-test<br/>spec:<br/>  ports:<br/>  - port: 8080<br/>    targetPort: 8080<br/>    protocol: TCP<br/>    name: tcp-8080<br/>  selector:<br/>    app: devops-argocd-test<br/>  type: NodePort<br/></code>

In Argo CD, add the repository (Settings → Repositories → Connect Repo using HTTPS) and then create an application pointing to the

manifests

folder. Screenshots of the UI steps are shown below:

Since the sync mode is manual, click the SYNC button to deploy. The application status changes to Healthy.

Verify the deployed resources:

<code># kubectl get pod | grep devops-argocd-test<br/>devops-argocd-test-7f5fdd9fcf-xbzmp   1/1   Running   0   118s<br># kubectl get svc | grep devops-argocd-test<br/>devops-argocd-test   NodePort   10.97.159.140   <none>   8080:31980/TCP   2m6s<br/></code>

Configuration Change

Update the image tag in

deployment.yaml

to

v2

and push the change to Git. Argo CD detects the drift and marks the application OutOfSync:

Manually sync again; the application returns to Healthy and the new version is served.

The application relationship view and deployment history are also available:

Rollbacks can be performed from the UI, though they do not modify the source repository.

You can switch the sync mode to automatic for a fully hands‑free workflow.

Official documentation: https://argoproj.github.io/argo-cd/#features
kubernetesdevopsContinuous DeliveryGitOpsArgo CD
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.