Overview
GitOps shines in multi-cluster environments. By treating clusters as just another resource to be declared in Git, you can scale management to hundreds of clusters consistently.
Strategies
- Hub-and-Spoke: A central management cluster (Hub) controls many target clusters (Spokes).
- Cluster Groups: Tag clusters (e.g.,
env=production,region=us-east) and apply GitOps policies to groups.
Example: ArgoCD ApplicationSet (Multi-Cluster)
Targeting multiple clusters based on labels.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
spec:
generators:
- clusters:
selector:
matchLabels:
environment: production
template:
spec:
project: default
destination:
server: '{{server}}'Result:
ArgoCD will automatically create/update an application in every cluster labeled with environment: production.
ArgoCD: Syncing 5 applications across 5 production clusters...
Status: Synced