Working with Multi-Cluster Federation

1. Understanding Multi-Cluster Patterns

PatternUse
HA / DRFailover across regions
Geo-routingLatency-optimized
Data sovereigntyRegulated regions
Hub & spokeCentral control, distributed data

2. Installing KubeFed

helm repo add kubefed-charts https://raw.githubusercontent.com/kubernetes-sigs/kubefed/master/charts
helm install kubefed kubefed-charts/kubefed -n kube-federation-system --create-namespace
Note: KubeFed DEPRECATED — prefer Karmada, Open Cluster Management (OCM), or Cluster API for modern federation.

3. Creating Federated Clusters

kubefedctl join cluster-us-east --cluster-context=us-east \
  --host-cluster-context=hub --v=2
kubefedctl join cluster-eu --cluster-context=eu \
  --host-cluster-context=hub --v=2

4. Deploying Federated Resources

apiVersion: types.kubefed.io/v1beta1
kind: FederatedDeployment
metadata: { name: web, namespace: prod }
spec:
  template:
    spec:
      replicas: 3
      template: { ... }
  placement:
    clusters:
    - { name: cluster-us-east }
    - { name: cluster-eu }
  overrides:
  - clusterName: cluster-eu
    clusterOverrides:
    - { path: /spec/replicas, value: 5 }

5. Configuring Placement Policies

MechanismDetail
clusters listExplicit names
clusterSelectorMatch by cluster labels
Karmada PropagationPolicyweighted, divided scheduling

6. Implementing Cross-Cluster Discovery

ToolDetail
Multi-Cluster Services (MCS)SIG API; ServiceExport / ServiceImport
SubmarinerFlat network + DNS across clusters
Istio multi-primaryCross-cluster mTLS + service mesh
Cilium Cluster MesheBPF-based service connectivity

7. Using Multi-Cluster Ingress

ApproachDetail
Global LBGCP Multi-Cluster Ingress, AWS Global Accelerator
DNS-basedExternal-DNS + weighted records, GeoDNS
Gateway APIGAMMA initiative for mesh + multi-cluster

8. Configuring Context Switching

kubectx prod-us prod-eu hub
kubectl config use-context prod-us
kubectl --context=prod-eu get pods

9. Implementing Disaster Recovery

Multi-Cluster DR Drill

  1. Velero snapshots restored to standby cluster
  2. External-DNS / global LB shifts traffic
  3. Stateful data: cross-region replication (DB, S3)
  4. Validate health, run smoke tests
  5. Failback after primary restored

10. Monitoring Federated Clusters

ToolDetail
ThanosGlobal Prometheus query view
Cortex / MimirHorizontally scalable, multi-tenant Prometheus
OCMOpen Cluster Management observability
Karmada dashboardFederated workload status