k8s

ADR-006: Multi-Cluster GitOps with Single Control Plane

Status

Accepted

Context

I needed a GitOps strategy that manages multiple Kubernetes clusters (dev, staging, prod, ops) while maintaining:

Traditional approaches have limitations:

Decision

I implemented a multi-cluster GitOps approach using:

  1. Single Argo CD Control Plane (in ops cluster) managing all clusters
  2. App-of-Apps Pattern (Helm chart) generating Applications for all components
  3. Environment-Specific Values Files (values.dev-01.yaml, values.prod-01.yaml) for overrides
  4. Git Branching Model (dev → staging → stable) for promotion
  5. Cluster Registration (remote clusters registered in Argo CD via cluster secrets)

Key Components:

Bootstrap Applications:

App-of-Apps Chart:

Git Promotion Flow:

Cluster Targeting:

Consequences

Positive

Negative

Mitigations

Alternatives Considered

1. Per-Cluster GitOps (Argo CD in Each Cluster)

Rejected because:

2. Flux Instead of Argo CD

Rejected because:

3. Terraform for Multi-Cluster Management

Rejected because:

4. Helm-Only (No GitOps Tool)

Rejected because:

5. GitOps per Environment (Separate Repos)

Rejected because:

6. Kustomize-Based App-of-Apps

Rejected because:

Implementation Details

Bootstrap Process:

  1. Register remote cluster in Argo CD: argocd cluster add <context>
  2. Apply bootstrap Application: kubectl apply -f argocd-bootstrap-apps/<cluster>.yaml
  3. Bootstrap Application installs app-of-apps chart with cluster-specific values
  4. Chart generates Applications for all enabled components
  5. Argo CD syncs Applications, deploying resources to target cluster

Application Naming:

Values File Strategy:

Sync Wave Management:

Promotion Workflow

  1. Development: Merge to dev branch → auto-syncs dev-01 cluster
  2. Staging: Merge devstaging branch → auto-syncs stag-01 cluster
  3. Production: Tag stable from stagingprod-01 and ops-01 track stable tag
  4. Emergency: Branch off stable, fix, retag, forward-merge to staging and dev

Benefits:

Monitoring & Observability

References