Working with Multi-Cluster Federation
1. Understanding Multi-Cluster Patterns
| Pattern | Use |
| HA / DR | Failover across regions |
| Geo-routing | Latency-optimized |
| Data sovereignty | Regulated regions |
| Hub & spoke | Central 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
| Mechanism | Detail |
| clusters list | Explicit names |
| clusterSelector | Match by cluster labels |
| Karmada PropagationPolicy | weighted, divided scheduling |
6. Implementing Cross-Cluster Discovery
| Tool | Detail |
| Multi-Cluster Services (MCS) | SIG API; ServiceExport / ServiceImport |
| Submariner | Flat network + DNS across clusters |
| Istio multi-primary | Cross-cluster mTLS + service mesh |
| Cilium Cluster Mesh | eBPF-based service connectivity |
7. Using Multi-Cluster Ingress
| Approach | Detail |
| Global LB | GCP Multi-Cluster Ingress, AWS Global Accelerator |
| DNS-based | External-DNS + weighted records, GeoDNS |
| Gateway API | GAMMA 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
- Velero snapshots restored to standby cluster
- External-DNS / global LB shifts traffic
- Stateful data: cross-region replication (DB, S3)
- Validate health, run smoke tests
- Failback after primary restored
10. Monitoring Federated Clusters
| Tool | Detail |
| Thanos | Global Prometheus query view |
| Cortex / Mimir | Horizontally scalable, multi-tenant Prometheus |
| OCM | Open Cluster Management observability |
| Karmada dashboard | Federated workload status |