Skip to content

Service Discovery and Load Balancing Across Clusters: CCA practice questions

Once clusters are connected, Cilium offers two ways to make a Service reachable across them. Global Services are a Cilium feature driven by annotations. The Multi-Cluster Services API (MCS-API) is the Kubernetes SIG Multicluster standard built on ServiceExport and ServiceImport, with status conditions and a clusterset.local DNS domain that Cilium can configure in CoreDNS.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Service Discovery and Load Balancing Across Clusters covers in CCA

Once clusters are connected, Cilium offers two ways to make a Service reachable across them. Global Services are a Cilium feature driven by annotations. The Multi-Cluster Services API (MCS-API) is the Kubernetes SIG Multicluster standard built on ServiceExport and ServiceImport, with status conditions and a clusterset.local DNS domain that Cilium can configure in CoreDNS. The documentation suggests MCS-API when you want a standard with higher-level features, and Global Services when you want to use Cilium annotations directly, keep different Service properties in each cluster, or control precisely how backends are shared. Both can be used together.

A Global Service is a Service with the same name and namespace in every cluster, annotated with service.cilium.io/global: "true". Cilium then load-balances requests to backends in all clusters. A global service implicitly shares its local backends; setting service.cilium.io/shared: "false" in one cluster keeps that cluster consuming remote backends while hiding its own, so its clients still reach every cluster but clients elsewhere no longer reach it.

Affinity adds preference instead of exclusion. service.cilium.io/affinity accepts none, the default, local or remote. With local, a cluster uses its healthy local backends and turns to remote ones only when no local backend is available, which keeps traffic close and still fails over. With remote, the preference is reversed. Inside an agent pod, cilium-dbg service list --clustermesh-affinity marks the preferred backends. With MCS-API the same annotation is passed through the exportedAnnotations field of the ServiceExport.

A few behaviours matter in operation. If a remote cluster becomes unreachable, Cilium keeps the last known backend data, so requests may still be sent to stale endpoints. clustermesh.cacheTTL defaults to 0s, which never revokes; a value such as 15m removes the cached backends of a cluster that stays disconnected and restores them when it returns. Global NodePort Services only use remote backends when Cilium replaces kube-proxy, and the same holds for access from nodes or host-network pods unless socket load balancing is enabled in the host namespace; otherwise just local backends are eligible.

Cilium does not create EndpointSlices for remote backends of a regular global service by default. Tools outside Cilium, such as DNS servers or a third-party ingress controller, can be given them with the annotation service.cilium.io/global-sync-endpoint-slices: "true" and the beta feature flag clustermesh.enableEndpointSliceSynchronization. Headless global services synchronize by default, and features of Cilium itself, including its ingress controller, work without this.

Key points

  • A global service needs the same name and namespace in each cluster plus service.cilium.io/global: "true".
  • service.cilium.io/shared: "false" stops a cluster from offering its backends while it still uses remote ones.
  • Affinity local prefers healthy local backends and fails over to remote ones.
  • clustermesh.cacheTTL defaults to 0s, so stale remote backends are kept unless it is set.

Three sample questions

13 CCA questions on Service Discovery and Load Balancing Across Clusters, 13 with explanations. How practice works

Question 1

Which annotation makes a Kubernetes Service globally available across a Cluster Mesh?
  1. A.service.cilium.io/global: "true"
  2. B.clustermesh.cilium.io/global-service: "true"
  3. C.cilium.io/global: "true"
  4. D.service.cilium.io/shared: "false"

Correct answer: A

A global service is a Service with the same name and namespace in each cluster plus the annotation service.cilium.io/global: "true"; Cilium then load-balances to backends in all clusters. Why the other options are wrong. clustermesh.cilium.io/global-service and cilium.io/global are not Cilium annotations. service.cilium.io/shared: "false" exists, but it stops a global service from sharing the local backends with other clusters; it does not make a service global.

Sources: Cilium docs: Global Services, Cilium docs: Multi-Cluster (Cluster Mesh)

Question 2

How does Cilium Cluster Mesh synchronize service information between clusters?
  1. A.Each cluster runs clustermesh-apiserver, which exposes local state through its own etcd that remote clusters read over mTLS
  2. B.All clusters write to one shared etcd cluster
  3. C.Kubernetes federation APIs copy Services between the clusters
  4. D.Each kube-apiserver forwards Service objects to the other clusters

Correct answer: A

Cluster Mesh is built around a per-cluster control plane in the clustermesh-apiserver pods: the apiserver container syncs local Cilium and Kubernetes state into an embedded etcd, which is exposed to remote clusters over mTLS, and kvstoremesh syncs remote state into the local cluster. Why the other options are wrong. One shared etcd: each cluster exposes its own etcd instance. Federation APIs: Cluster Mesh does not use Kubernetes federation. kube-apiserver forwarding: the API servers are not connected to each other; the agents read remote state through Cluster Mesh.

Sources: Cilium docs: Multi-Cluster (Cluster Mesh), Cilium docs: Setting up Cluster Mesh

Question 3

Which statement about global services in Cilium Cluster Mesh is true?
  1. A.All services in a cluster are automatically global
  2. B.Services must be annotated to be accessible globally
  3. C.Only services of type LoadBalancer can be global
  4. D.Global services require special DNS configuration

Correct answer: B

A Service only becomes global when it exists with the same name and namespace in each cluster and carries the annotation service.cilium.io/global: "true". Why the other options are wrong. Services are not global automatically. Any Service type can be global; the docs example is a ClusterIP Service. No special DNS configuration is needed for Global Services (the separate MCS-API option uses the clusterset.local domain).

Sources: Cilium docs: Global Services, Cilium docs: Multi-Cluster (Cluster Mesh)

Practice this topic

Focus mode keeps every question on Service Discovery and Load Balancing Across Clusters until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CCA practice across all topics.

Sources

The explanation above was checked against these official documents.