/gitops-argo-skills:gitops-multi-cluster-managementfrom gitops-argo-skills
Designs hub-and-spoke GitOps topology for managing a fleet of Kubernetes clusters from one Argo CD control plane — cluster registration, RBAC scoping per spoke cluster, and using the ApplicationSet cluster generator to roll out workloads fleet-wide.
Ships in gitops-argo-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Once an organization runs more than a few Kubernetes clusters (per
environment, per region, per customer, or per team), running a separate
Argo CD instance per cluster stops scaling — every fleet-wide change
requires N manual repeats, and there's no single place to answer "what
version is running where across the whole fleet." Hub-and-spoke topology
puts one Argo CD control plane (the "hub," itself running on a cluster) in
charge of reconciling Applications onto many registered "spoke"
clusters, using
argocd-applicationset-patterns'
Cluster generator to template per-cluster Applications automatically.
This matters operationally because it turns fleet management from "how do
we remember to update every cluster" into "how do we register/label a
cluster correctly once," and it centralizes the audit trail and RBAC
boundary for who can change what, where.
Application
manifests for it.ServiceAccount +
ClusterRole/ClusterRoleBinding created on the spoke that Argo CD
authenticates as, scoped to only the namespaces/resource kinds that
cluster's workloads need — not the spoke's own cluster-admin.argocd CLI with hub cluster context configured
(argocd login <HUB_ARGOCD_SERVER>), and kubectl contexts for each
spoke cluster available locally for registration and verification.Register each spoke cluster with the hub, either via the CLI
(creates the underlying Secret for you) or by authoring the Secret
directly for GitOps-managed registration:
argocd cluster add <SPOKE_KUBECONFIG_CONTEXT> \
--name us-east-1-prod \
--label tier=production \
--label region=us-east-1
Declarative equivalent (preferred for auditability — the registration itself becomes a Git-tracked change):
apiVersion: v1
kind: Secret
metadata:
name: cluster-us-east-1-prod
namespace: argocd
labels:
argocd.argoproj.io/secret-type: cluster
tier: production
region: us-east-1
type: Opaque
stringData:
name: us-east-1-prod
server: https://<SPOKE_API_SERVER_ENDPOINT>
config: |
{
"bearerToken": "${SPOKE_CLUSTER_TOKEN}",
"tlsClientConfig": {
"insecure": false,
"caData": "${SPOKE_CA_DATA_BASE64}"
}
}
The ${SPOKE_CLUSTER_TOKEN}/${SPOKE_CA_DATA_BASE64} placeholders
must be filled from a secrets-management pipeline (Sealed Secrets,
External Secrets Operator) before this is committed — never commit the
literal bearer token in plaintext, per
gitops-workflow's
secrets guidance.
Scope the spoke-side ServiceAccount narrowly, created on each spoke cluster before registration, rather than granting the hub cluster-admin on every spoke:
# Applied ON the spoke cluster, not the hub
apiVersion: v1
kind: ServiceAccount
metadata:
name: argocd-manager
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: argocd-manager-role
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# Narrow this to only the resource kinds/namespaces this spoke's
# workloads actually need, rather than "*" on every fleet member —
# a platform-agent-only spoke needs far less than an
# application-workload spoke.
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: argocd-manager-role-binding
subjects:
- kind: ServiceAccount
name: argocd-manager
namespace: kube-system
roleRef:
kind: ClusterRole
name: argocd-manager-role
apiGroup: rbac.authorization.k8s.io
Warning: the Argo CD documentation's default cluster-registration
ClusterRolegrants*/*across all resources for convenience. Treat that as a starting point to narrow, not a safe production default — a hub credential with cluster-admin on every spoke means a single hub compromise is a fleet-wide compromise.
Use AppProject to scope which clusters/namespaces/repos an
Application or ApplicationSet may target, per team or tier:
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: platform-team
namespace: argocd
spec:
sourceRepos:
- https://github.com/example/gitops-config.git
destinations:
- server: "*"
namespace: platform-system
clusterResourceWhitelist:
- group: ""
kind: Namespace
Restricting destinations and clusterResourceWhitelist per
AppProject bounds what any Application/ApplicationSet assigned to
that project can touch, independent of the broader hub RBAC.
Roll workloads out fleet-wide with the ApplicationSet Cluster
generator, filtering by the labels set at registration (full
mechanics in
argocd-applicationset-patterns):
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: fleet-baseline
namespace: argocd
spec:
goTemplate: true
generators:
- clusters:
selector:
matchLabels: { tier: production }
template:
metadata:
name: "fleet-baseline-{{.name}}"
spec:
project: platform-team
source:
repoURL: https://github.com/example/gitops-config.git
targetRevision: main
path: fleet/baseline
destination:
server: "{{.server}}"
namespace: platform-system
syncPolicy:
automated: { prune: true, selfHeal: true }
syncPolicy:
preserveResourcesOnDeletion: true
New clusters registered with tier: production automatically receive
fleet-baseline's workloads on the next generator refresh — no manual
Application authored per cluster.
Stage fleet-wide rollouts in waves, not one atomic push, using labels to phase which clusters receive a change first:
generators:
- clusters:
selector:
matchLabels: { tier: production, rollout-wave: "1" }
Bump rollout-wave labels on a subset of clusters first (canary
clusters), verify, then relabel the remaining fleet — this is the
multi-cluster analog of canary weighting within a single cluster (see
argo-rollouts-progressive-delivery),
applied at the cluster-fleet level instead of the traffic-percentage
level.
Decide hub topology deliberately: one shared hub for the whole fleet is simplest to operate but is a single point of failure and a single blast radius for a hub-side misconfiguration; per-region or per-tier hubs (e.g., a hub per compliance boundary) add operational overhead but bound blast radius and reduce cross-region API latency for reconciliation. Choose based on fleet size, compliance boundaries (data residency requirements often force separate hubs per region), and how much a hub outage should be allowed to affect.
Verify fleet state centrally:
argocd cluster list
argocd app list -l argocd.argoproj.io/application-set-name=fleet-baseline
kubectl get applications -n argocd -o custom-columns=NAME:.metadata.name,SYNC:.status.sync.status,HEALTH:.status.health.status
A single argocd app list (or equivalent kubectl get applications)
against the hub answers "what's deployed where and is it healthy"
across the entire fleet — the concrete payoff of centralizing on one
control plane.
ApplicationSet Cluster generator selects its targets, and
retrofitting a taxonomy onto an already-large fleet means auditing and
relabeling every cluster Secret.Secret manifest committed to Git,
values injected via a secrets pipeline) rather than only via
argocd cluster add run ad hoc from someone's laptop — the former is
auditable and reproducible; the latter isn't.argocd-manager ClusterRole as something to narrow per
spoke's actual workload set, not a fleet-wide copy-paste of the
broadest example.ApplicationSet targeting the entire fleet with automated: {selfHeal: true} means one bad manifest reaches every cluster
simultaneously with no canary period.ApplicationSet template's parameterization (values injected from the
cluster Secret's own labels/fields) rather than one-off manual
Application edits that bypass the generator entirely and silently
drift from the fleet-wide pattern.Symptom: A newly registered cluster doesn't receive any of the
expected fleet-wide Applications.
Fix: Check the cluster Secret's labels against every fleet
ApplicationSet's clusters.selector — the most common cause is a
missing or mistyped label at registration time. Confirm with
kubectl get secret -n argocd -l argocd.argoproj.io/secret-type=cluster --show-labels before assuming the ApplicationSet itself is broken.
Symptom: A change rolled out via a fleet-wide ApplicationSet broke
every cluster simultaneously, with no canary warning.
Fix: This is the risk of targeting the entire fleet in one
generator match with automated sync and no wave staging. Adopt a
rollout-wave label dimension (step 5) so future fleet-wide changes hit
a small labeled subset first, and roll back the current incident via
Git revert (per
gitops-workflow),
which the fleet's selfHeal will then propagate back out uniformly.
Symptom: The hub Argo CD instance's reconciliation is falling further and further behind as more clusters were added, and drift detection/alerts are now hours stale. Fix: This is hub capacity, not spoke-side, and shows up as generically "slow" rather than a specific error — check controller resource limits and reconciliation queue metrics on the hub itself, and consider splitting into per-region/per-tier hubs (step 6) once a single hub's reconciliation latency for the fleet size exceeds acceptable drift-detection windows.
Symptom: A spoke cluster's argocd-manager credential was scoped
to cluster-admin "to avoid RBAC troubleshooting," and a later
investigation found the hub's compromise blast radius included every
spoke with that same broad role.
Fix: Audit every spoke's ClusterRole bound to the hub's service
account and narrow each to the specific resource kinds/namespaces that
spoke's workloads require (step 2) — treat "cluster-admin on the spoke"
as a finding to remediate, not an acceptable operational shortcut.
Symptom: Deregistering a decommissioned cluster (deleting its
cluster Secret) also deleted the fleet-wide Applications that
targeted it, which cascaded to delete the live workloads on a cluster
that was actually still receiving production traffic during a delayed
decommission window.
Fix: This is the same underlying mechanism as the ApplicationSet
pruning pitfall in
argocd-applicationset-patterns
— set syncPolicy.preserveResourcesOnDeletion: true on fleet-wide
ApplicationSets, and treat cluster deregistration as a two-step
process (drain/verify no traffic first, deregister second) rather than
a single irreversible action.
Scenario: Roll a new network-policy-baseline workload out to every
production cluster in a 40-cluster fleet, staged as a 3-cluster canary
wave before the remaining 37.
rollout-wave: canary (in addition to their existing tier: production label); the remaining 37 keep rollout-wave: stable.ApplicationSet:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: network-policy-baseline-canary
namespace: argocd
spec:
goTemplate: true
generators:
- clusters:
selector:
matchLabels: { tier: production, rollout-wave: canary }
template:
metadata: { name: "netpol-baseline-{{.name}}" }
spec:
project: platform-team
source:
repoURL: https://github.com/example/gitops-config.git
targetRevision: main
path: fleet/network-policy-baseline
destination: { server: "{{.server}}", namespace: kube-system }
syncPolicy: { automated: { prune: true, selfHeal: true } }
syncPolicy: { preserveResourcesOnDeletion: true }
argocd app list -l argocd.argoproj.io/application-set-name=network-policy-baseline-canary
that all 3 canary clusters are Synced/Healthy, and confirm no
unexpected traffic drops from the new policy over a soak window.rollout-wave: stable
to rollout-wave: canary (or introduce a second ApplicationSet
targeting rollout-wave: stable with the same path), so the
Cluster generator picks them up on its next refresh and the same
baseline reaches the full fleet.kubectl get applications -n argocd -l argocd.argoproj.io/application-set-name=network-policy-baseline-canary -o custom-columns=NAME:.metadata.name,SYNC:.status.sync.status
gives a single-command view confirming all 40 clusters converged,
rather than checking each cluster individually.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin gitops-argo-skills11 skills in this plugin
/argocd-application-configurationConfigures Argo CD `Application` custom resources — sync policies (automated vs. manual, prune, self-heal), sync waves and hooks for ordered/multi-phase rollouts, and health checks for custom resource types. Use when the user asks to "write an Argo CD Application manifest," "enable auto-sync / self-heal / prune," "order resources with sync waves," "add a PreSync/PostSync hook," "fix an Application stuck OutOfSync or Progressing," or "define a custom health check for a CRD Argo CD doesn't understand natively."
/argocd-applicationset-patternsDesigns Argo CD `ApplicationSet` resources that template many `Application` objects from a single source using generators — List, Cluster, Git directory/file, and Matrix (combined generators). Use when the user asks to "generate an Application per cluster/environment/ directory," "avoid copy-pasting Argo CD Applications," "roll out a service to a fleet of clusters," "combine a cluster generator with a Git generator," or "debug an ApplicationSet producing unexpected or missing Applications."
/argocd-sync-failure-and-drift-investigationTroubleshoots Argo CD `Application`s that are stuck or failing — `OutOfSync`/`Progressing`/`Degraded` states, `PreSync`/`Sync`/`PostSync` hook Jobs that fail or hang, resource-level diffs that are hard to read, and distinguishing drift caused by an out-of-band `kubectl edit`/`kubectl patch` from genuine configuration drift between Git and the live cluster. Use when the user asks to "debug why an Argo CD app is OutOfSync," "figure out what's actually different between Git and the cluster," "a sync hook is failing/stuck," "someone kubectl edited a resource Argo CD manages," or "an Application says Synced but the cluster doesn't match Git."
/argo-events-and-event-driven-automationConfigures Argo Events `EventSource`, `Sensor`, and `EventBus` CRDs to trigger Argo Workflows, Kubernetes resource changes, or other actions from external events — webhooks, message queues (Kafka/NATS/SQS/ RabbitMQ), and cron schedules. Use when the user asks to "trigger an Argo Workflow from a webhook," "wire up an EventSource for S3/Kafka/ GitHub events," "fan events out to multiple triggers with a Sensor," "debug a Sensor that isn't firing," or "build event-driven automation on Kubernetes without a separate message broker to operate."
/argo-rollouts-progressive-deliveryConfigures the Argo Rollouts `Rollout` CRD as a drop-in replacement for a Kubernetes `Deployment`, covering canary and blue-green strategy mechanics, traffic management integration (service mesh/ingress controllers), and `AnalysisTemplate`/`AnalysisRun` for automated metric-based promotion and rollback. Use when the user asks to "convert a Deployment to an Argo Rollout," "configure canary steps with setWeight/pause," "wire up an AnalysisTemplate against Prometheus/ Datadog," "fix a Rollout stuck mid-canary," or "automate rollback on bad metrics with Argo Rollouts."
/argo-workflows-pipeline-designDesigns Argo Workflows pipelines using the `Workflow`/`WorkflowTemplate`/ `CronWorkflow` CRDs — choosing DAG vs. steps templates, passing artifacts and parameters between steps, and structuring Kubernetes-native batch/ML pipelines distinct from a CI system. Use when the user asks to "write an Argo Workflow," "build a DAG pipeline on Kubernetes," "pass an artifact between workflow steps," "reuse a WorkflowTemplate across pipelines," "schedule a recurring Argo CronWorkflow," or "decide whether a batch job belongs in Argo Workflows vs. a CI pipeline."
Other plugins' skills for the same job