MeshMultiZoneService

Uses: Kong Mesh

MeshMultiZoneService gathers the MeshService resources for one service across zones into a single destination. A client names it instead of a per-zone service, and reaches whichever zones are available.

MeshMultiZoneService is the destination kind that cross-zone failover attaches to: MeshLoadBalancingStrategy accepts localityAwareness.crossZone only on a to entry targeting a MeshMultiZoneService, because the failover order is a statement about zones and this is the resource that spans them.

It isn’t a policy: there is no targetRef, and the resource is the destination itself. You create it on the global control plane only, which then syncs it out to zones.

Aggregate a service across zones

The following example creates a backend destination from every MeshService named backend, in every zone, and exposes their http port as port 80:

Selecting services

spec.selector.meshService.matchLabels picks the MeshService resources to aggregate. The usual selector is kuma.io/display-name, which matches the same service in every zone, since a synced MeshService’s resource name carries a zone-specific hash while its display name doesn’t.

Adding kuma.io/zone narrows the aggregate to particular zones, which is how you expose a service across a subset of them.

A display name is not unique across namespaces. kuma.io/display-name: backend matches every MeshService called backend in every namespace of every zone, including an unrelated service that happens to share the name. The aggregate then load balances across all of them, and requests that land on the unintended one usually fail authorization instead of returning a visible error. Add k8s.kuma.io/namespace on Kubernetes to pin the aggregate to one namespace, and read the MeshServicesMatched condition to confirm the count is what you expect.

Ports

spec.ports[] lists the ports the aggregate exposes, and at least one is required. Each takes a port, an optional name, and an appProtocol that defaults to tcp.

The ports are the aggregate’s own, drawn from the selected services. The control plane matches each entry to a port of each selected MeshService by name. The entry’s name (or its port as a string when name is unset) must equal a MeshService port’s name or port number. A MeshService with no matching port contributes no endpoints for that entry. On Kubernetes, a generated MeshService port takes the Service port’s name, or its number when the port is unnamed.

A MeshMultiZoneService referenced in a route’s backendRefs requires a port on the reference, unlike a MeshService, where the control plane can infer it.

Reading the status

The control plane reports what it computed for a MeshMultiZoneService in the resource’s status. The following table describes its fields:

Field

Reports

meshServices Every matched MeshService, with its name, namespace, zone, and mesh. This is the list to check first when traffic isn’t reaching a zone.
vips The virtual IPs assigned to the aggregate.
addresses The generated hostnames, and which generator produced each.
hostnameGenerators Per-generator status.
conditions MeshServicesMatched, with a reason of MatchesFound or NoMatchesFound.

A MeshServicesMatched condition reporting NoMatchesFound means the selector matched nothing. If the labels look right, check that the per-zone MeshService resources have synced to the global control plane, and that you are matching on kuma.io/display-name rather than the hashed resource name.

Zone eligibility

A matched MeshService from another zone is used only while its spec.state is Available, which it is when at least one of its endpoints is healthy. That state is what the aggregate consults when deciding whether a remote zone can take traffic, so a zone whose service has no healthy endpoints drops out without any change here. The local zone’s service is always used, since it only contributes endpoints that exist.

Reaching another zone also requires a MeshIdentity in the mesh and a MeshZoneAddress for the destination zone. Without them, remote services contribute no endpoints. For more information, see Mesh-scoped zone proxies.

A client also needs the MeshMultiZoneService in its reachableBackends (the kuma.io/reachable-backends annotation on Kubernetes), or it gets no outbound for it.

MeshLoadBalancingStrategy sets how traffic is distributed across the remaining zones. Locality awareness prefers the local zone, and crossZone.failover sets the order the others are tried in. MeshHealthCheck and MeshCircuitBreaker cover the other case: endpoints that are present and reachable but answering badly, which nothing else detects.

Schema

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!