Depending on where a policy is created (in an application namespace, the system namespace, or on the global control plane)
and how its schema is structured, Kong Mesh assigns it a policy role.
A policy’s role determines:
- How it’s synchronized for each policy in multi-zone deployments.
- How it’s prioritized when multiple policies overlap.
The table below introduces the policy roles and how to recognize them.
|
Policy role
|
Controls
|
Type by schema
|
Multi-zone sync
|
|
Producer
|
Outbound behavior of callers to your service (your clients’ egress toward you).
|
Has spec.to. Every to[].targetRef.namespace, if set, must be equal to metadata.namespace.
|
Defined in the app’s namespace on a zone CP. Synced to the global CP, then propagated to other zones.
|
|
Consumer
|
Outbound behavior of your service when calling others (your egress).
|
Has spec.to. At least one to[].targetRef.namespace is different from metadata.namespace.
|
Defined in the app’s namespace on a zone CP. Synced to the global CP.
|
|
Workload-owner
|
Configuration of your own proxy: inbound traffic handling and sidecar features (for example metrics, traces).
|
Either has spec.rules, or has neither spec.rules nor spec.to (only spec.targetRef + proxy/sidecar settings).
|
Defined in the app’s namespace on a zone CP. Synced to the global CP.
|
|
System
|
Mesh-wide behavior: can govern both inbound and outbound across services (operator-managed).
|
Resource is created in the system namespace (for example kong-mesh-system).
|
Created in the system namespace, either on a zone CP or on the global CP.
|
Producer policies allow service owners to define recommended client-side behavior for calls to their service by creating the policy in their service’s own namespace.
Kong Mesh then applies it automatically to the outbounds of client workloads.
This lets backend owners publish sensible defaults (timeouts, retries, limits) for consumers,
while individual clients can still refine those settings with their own consumer policies.
The following policy tells Kong Mesh to apply 3 retries with a backoff from 15s to 1m
on 5xx errors to any client calling backend:
apiVersion: kuma.io/v1alpha1
kind: MeshRetry
metadata:
namespace: backend-ns # created in the backend's namespace
name: backend-producer-timeouts
spec:
targetRef:
kind: Mesh # any caller
to:
- targetRef:
kind: MeshService
name: backend
namespace: backend-ns # same namespace as the policy (producer rule)
default:
numRetries: 3
backOff:
baseInterval: 15s
maxInterval: 1m
retryOn:
- 5xx
Consumer policies let service owners adjust how their workloads call other services.
They are created in the client’s namespace and applied to that client’s outbounds.
This way, the service owner can fine-tune retries, timeouts, or other settings for the calls their workloads make.
apiVersion: kuma.io/v1alpha1
kind: MeshRetry
metadata:
namespace: frontend-ns # created in the namespace of a client
name: backend-consumer-timeouts
spec:
targetRef:
kind: Mesh # any caller, but only in 'frontend-ns' since consumer policies are always scoped to the namespace of origin
to:
- targetRef:
kind: MeshService
name: backend
namespace: backend-ns # different namespace from the policy (consumer rule)
default:
numRetries: 0
Workload-owner policies let service owners configure their own workload’s proxies.
They are created in the workload’s namespace and control how proxies handle inbound traffic,
while also enabling various proxy-level features such as MeshMetric, MeshProxyPatch, and others.
Workload-owner policies either have spec.rules for inbound traffic configuration:
apiVersion: kuma.io/v1alpha1
kind: MeshTrafficPermission
metadata:
namespace: backend-ns # created in the namespace of a server
name: backend-permissions
spec:
targetRef:
kind: Dataplane
labels:
app: backend
rules:
- default:
deny:
- spiffeID:
type: Exact
value: spiffe://trust-domain.mesh/ns/default/sa/legacy
allow:
- spiffeID:
type: Prefix
value: spiffe://trust-domain.mesh/
Or only spec.default for proxy-level features like metrics and tracing:
apiVersion: kuma.io/v1alpha1
kind: MeshMetric
metadata:
name: otel-metrics-delegated
namespace: backend-ns
spec:
default:
sidecar:
profiles:
appendProfiles:
- name: All
backends:
- type: OpenTelemetry
openTelemetry:
endpoint: opentelemetry-collector.mesh-observability.svc:4317
refreshInterval: 30s
System policies provide mesh-wide defaults managed by platform operators.
Any policy can be a system policy as long as it’s created in the system namespace (kong-mesh-system by default) on either a zone control plane or the global control plane.