Skip to main content
Cluster operationsLesson 16 of 16

Running a Fleet of Clusters

Sooner or later one cluster becomes several. Follow a small fleet as it grows: Git → Argo CD → clusters, a new cluster made by Cluster API, a Service shared across clusters, and the drift and version skew that a fleet collects over time.

Clusters2
Sync—
Cross-cluster name—
Versions1.34 · 1.34
Management clusterprod-a · Seoulprod-b · Tokyoprod-c · newUsersKorea and JapanGlobal LBDNS or anycastGit repoFleet desired stateArgo CDApplicationSetCluster APICluster · Machinescheckoutk8s 1.34checkoutk8s 1.34checkoutk8s 1.35ServiceImportclusterset.localRequests
RequestResponse / reportWatchAppears in a later step

What you will learn

  • Why teams run several clusters instead of one big one
  • One ApplicationSet that deploys to every matching cluster
  • Creating clusters declaratively with Cluster API
  • ServiceExport, ServiceImport and clusterset.local names
  • Drift and version skew across a fleet, and how to catch them

Multi-cluster building blocks​

NeedApproachTool examplesWatch out for
Same apps on every clusterGitOps with a per-cluster generatorArgo CD ApplicationSet, FluxPer-cluster overrides that grow until every cluster is special
Create and upgrade clustersDeclarative cluster lifecycleCluster API, Terraform, managed servicesMachine replacement during upgrades needs spare capacity and PodDisruptionBudgets
Find a Service in another clusterMulti-Cluster Services APIGKE multi-cluster Services, SubmarinerThe same namespace name means the same owner in every cluster
Send users to a healthy clusterGlobal load balancingDNS with health checks, anycast load balancersDNS TTLs delay failover
mTLS and failover between clustersMulti-cluster meshIstio multi-primary, Linkerd multicluster, Cilium Cluster MeshA shared root CA and network reachability between clusters
Know what runs whereFleet inventoryArgo CD cluster list, Cluster API status, cloud consolesVersion skew in Kubernetes and add-ons

Try it yourself​

kubectl config get-contexts # Which clusters this kubeconfig knows
argocd cluster list # Clusters registered with Argo CD
kubectl get secret -n argocd -l argocd.argoproj.io/secret-type=cluster --show-labels # Labels the generator selects on
kubectl get applicationset -n argocd # Fleet-wide app definitions
kubectl get applications -n argocd # One per cluster: SYNC STATUS and HEALTH
kubectl get clusters,machinedeployments -A # On the management cluster (Cluster API)
clusterctl describe cluster prod-c -n fleet # Control plane and machine readiness
clusterctl get kubeconfig prod-c -n fleet > prod-c.kubeconfig # Credentials for the new cluster
kubectl get serviceexport,serviceimport -n shop # Multi-Cluster Services objects
for ctx in prod-a prod-b prod-c; do # Version skew across the fleet
echo "$ctx $(kubectl --context "$ctx" version -o json | jq -r .serverVersion.gitVersion)"
done

Check yourself

  1. A new cluster with the label env=prod is registered in Argo CD. What does an ApplicationSet with a clusters generator selecting env=prod do?
  2. Why does a Pod in prod-b use checkout.shop.svc.clusterset.local instead of checkout.shop.svc.cluster.local?
  3. The same manifest syncs in two clusters but fails in a third that was created later. What is the most likely cause?

Further reading: Cluster API book · Argo CD cluster generator · Multi-Cluster Services API (KEP-1645) · SIG Multicluster · Istio multicluster installation · Kubernetes version skew policy · Helm and GitOps · When a Whole Region Goes Down