Resource scoping

Uses: Kong Mesh
Related Documentation
Minimum Version
Kong Mesh - 3.0

A multi-zone Kong Mesh deployment has one global control plane and one zone control plane in each zone. Each zone control plane connects to the global control plane over the Kuma Discovery Service (KDS), a two-way synchronization channel. The control plane where a resource is first stored owns that resource. A copy that another control plane receives over KDS is read-only, so you change the resource only on the control plane that owns it. For how the control planes connect, see How the control planes connect.

Resources reach the mesh in three ways:

  • Global resources: You create them on the global control plane. The global control plane sends a copy to each zone.
  • Zone resources: You create them on a zone control plane. On a Kubernetes zone, you create them with kubectl.
  • Workload resources: The zone control plane creates a Dataplane for each proxy and a MeshService for each service in its zone. The zone control plane sends them to the global control plane, and the global control plane sends each MeshService to the other zones.

Resource ownership

The following table shows where you create each resource, and where it lives on Kubernetes:

Resource

Who creates it

Location on Kubernetes

Why

Mesh You, on the global control plane. The zone copy is cluster-scoped and has no namespace. The Mesh defines the mesh boundary for every zone. Identity, mTLS, and traffic behavior come from separate resources and policies.
MeshMultiZoneService You, on the global control plane. The zone copy is in kong-mesh-system. Only the global control plane has the services of every zone, which it needs to combine them into one destination.
MeshIdentity and MeshTrust You, on the global control plane or on a zone control plane. Only in kong-mesh-system. Create them on the global control plane to share one identity configuration. Create them on a zone control plane when the issuer and trust belong to that zone only.
Mesh-wide policy, for example MeshTLS You, on the global control plane or on a zone control plane. On a zone, kong-mesh-system. A policy on the global control plane gives every zone the same baseline. A policy in the zone system namespace applies to the whole zone.
Workload policy, for example MeshTimeout You, on the zone control plane where the workloads run. Usually the namespace of the workloads that the policy governs. A policy in an application namespace stays within the scope of the application team that owns that namespace.
MeshExternalService You, on the global control plane or on a zone control plane. Only in kong-mesh-system. Create it on the global control plane for a dependency that every zone uses. Create it on a zone control plane when only that zone can reach the endpoints.
MeshOpenTelemetryBackend You, on the global control plane or on a zone control plane. Only in kong-mesh-system. Observability policies select the backend by its labels, so it’s shared infrastructure for every team.
MeshZoneAddress On Kubernetes, the zone control plane creates it from the zone ingress Service. On Universal, you create it on the zone control plane. The namespace of the zone ingress Service. When Helm deploys the zone ingress, that’s kong-mesh-system. Only the zone knows the address where other zones reach its zone ingress. The zone control plane sends it to the global control plane, which sends it to the other zones.

For more about each workload resource, see MeshService and Mesh-scoped zone proxies.

Global resources

Create the Mesh on the global control plane before you deploy workloads into it. Also create global resources such as MeshMultiZoneService there. The global control plane then sends a read-only copy to each connected zone. On Kubernetes, a zone stores the copy of a namespaced resource in kong-mesh-system.

A zone control plane that’s connected to a global control plane can’t create a global resource. For example, if you apply a Mesh with kubectl on that zone, the admission webhook rejects it. A zone control plane that isn’t connected to a global control plane accepts a Mesh, because it has no global control plane to receive one from.

Zone resources on Kubernetes

A zone resource in the system namespace needs the kuma.io/mesh label, unless it belongs to the default mesh:

metadata:
  namespace: kong-mesh-system
  labels:
    kuma.io/mesh: my-mesh

The zone control plane adds the other resource labels, such as kuma.io/origin, kuma.io/zone, and kuma.io/policy-role, when it stores the resource. Don’t copy these labels from a synced resource into new YAML. If you set one of these labels to a value that differs from the value the control plane computes, the control plane rejects the resource.

Namespaces that each resource type accepts

On Kubernetes, you can create the following resource types only in kong-mesh-system:

  • MeshIdentity
  • MeshTrust
  • MeshExternalService
  • MeshOpenTelemetryBackend
  • HostnameGenerator

You can create policies, MeshService, and MeshZoneAddress resources in an application namespace on a zone control plane. A zone control plane that’s connected to a global control plane rejects a MeshMultiZoneService, because only the global control plane can create one.

The namespace of a policy limits which proxies it reaches. For the rules, see Policy scope.

Universal zones

To create a resource on a Universal zone, run kongctl against the control plane that owns it. In the following commands, MESH_CP is the name of that control plane:

kongctl apply mesh -f mesh-traffic-permission.yaml --control-plane-name "$MESH_CP"

Before you change a resource, read its kuma.io/origin label to find the control plane that owns it:

kongctl get mesh meshtrafficpermissions --control-plane-name "$MESH_CP" --mesh my-mesh -o yaml

Update a resource with kuma.io/origin: global on the global control plane, and a resource with kuma.io/origin: zone on the zone that owns it. For a self-managed control plane, replace --control-plane-name with --control-plane-url and the address of its API. For more kongctl options, see Kong Mesh CLI.

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!