What is ArgoCD, and can it power a templated CD project?
- Posted
- Tags
- argocd, gitops, kubernetes
ArgoCD pulls deployments from Git into the cluster and corrects drift. An ApplicationSet is what makes a templated, subscribe-by-form CD project practical.
I am researching a personal project: a templated continuous delivery setup that teams subscribe to by filling in a form. It is GitOps in practice, and the tool at the center of it is ArgoCD. Before building anything, I wanted to understand why ArgoCD fits.
The question I had
What is ArgoCD, and how can it help with a centralized CD project?
What I found
ArgoCD in short
ArgoCD is a continuous deployment tool that delivers deployments and makes sure the cluster does not drift from what was declared. It uses a pull-based model: it runs inside the Kubernetes cluster, watches a config repo, pulls in changes, and reverts anything that drifts from Git. It also has a rich UI that teams can use to see their deployments.
How it works
ArgoCD adds custom controllers to the cluster that listen for Custom Resource Definitions (CRDs) like Application and ApplicationSet. They talk directly to the Kubernetes API server, so ArgoCD can watch Git, apply changes, and lean on native Kubernetes orchestration to deploy and manage workloads.
Application vs ApplicationSet
This was the key decision for the repo and work split.
- Application: every subscribing team would duplicate many Kubernetes manifest files. That gets tedious and conflict-prone, and every team would need write access to the central GitOps repo.
- ApplicationSet: this is where the template approach shines. A Git file generator parses a subscription list dynamically, and a merge generator applies default values with team-specific overrides on top.
The four repositories
| Repo | What it holds | Who writes to it |
|---|---|---|
| GitOps repo | The app registry, where teams list their microservices and definitions. This is the repo ArgoCD watches for drift. | The platform, through the registry entries |
| Template repo | Ready-to-use templates, like a web service on a regular Deployment or a db service on a StatefulSet with PVCs. The GitOps repo just references these. | The platform, plus teams who PR templates they need |
| Team logic repo | The service and business logic. | Each team |
| Team config repo | The Kubernetes manifests per microservice, with a path per environment (dev, qa, staging, prod). Team CI/CD updates this repo, not the GitOps repo. | Each team |
The GitOps repo reads the team config repo to know what to deploy, so teams never need write access to the central repo.
Multi-env and multi-cluster
Teams choose which environments and clusters they deploy to. The list of clusters is finite. Environments are up to each team, and I treat each one as an entirely separate app: its own registry entry, its own ArgoCD Application, and a namespace the team defines for it. Nothing is shared between dev and prod except the template they came from.
Onboarding with registry entries
A team adds an entry per environment to a single app-registry.json. Something like this:
{
"apps": [
{
"name": "payments-api-dev",
"template": "webservice",
"configRepo": "https://github.com/example-org/payments-config",
"path": "envs/dev",
"cluster": "ap-southeast-1",
"namespace": "payments-dev"
},
{
"name": "payments-api-prod",
"template": "webservice",
"configRepo": "https://github.com/example-org/payments-config",
"path": "envs/prod",
"cluster": "ap-southeast-2",
"namespace": "payments-prod"
},
{
"name": "inventory-api-prod",
"template": "dbservice",
"configRepo": "https://github.com/example-org/inventory-config",
"path": "envs/prod",
"cluster": "ap-southeast-2",
"namespace": "inventory"
}
]
}
The first team runs dev and prod on different clusters. The second team only has prod, so it has a single entry and uses the dbservice template. Neither team has to know about the other.
The ApplicationSet turns each entry into its own ArgoCD Application. This is a trimmed sketch of the idea, and I have not tested it yet:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: team-apps
spec:
generators:
- merge:
mergeKeys: [name]
generators:
- git: # defaults shared by every team
repoURL: https://github.com/example-org/gitops
revision: main
files:
- path: defaults/*.json
- git: # the subscription list, with team overrides
repoURL: https://github.com/example-org/gitops
revision: main
files:
- path: app-registry.json
template:
metadata:
name: "{{name}}"
spec:
project: default
source:
repoURL: "{{configRepo}}"
targetRevision: main
path: "{{path}}"
destination:
server: "{{cluster}}"
namespace: "{{namespace}}"
syncPolicy:
automated:
prune: true
selfHeal: true
With default templates, a team can have an application running in minutes. A template does not lock anyone in either: teams can write their own manifest files as overrides, and ArgoCD deploys and manages those too.
Takeaway
ArgoCD runs inside the cluster, uses CRDs to talk to the Kubernetes API server, and keeps the cluster matching Git. For a templated CD project, the ApplicationSet is the piece that matters: one registry file, shared defaults, per-team overrides, and every environment treated as its own app, without handing every team write access to the central repo. I am still in the research and planning phase, and I am looking forward to building this.