Careful!
You are browsing documentation for a version of Kuma that is not the latest release.
MeshTrafficPermission
This policy uses new policy matching algorithm. Do not combine with TrafficPermission.
Mutual TLS has to be enabled to make MeshTrafficPermission work.
The MeshTrafficPermission
policy provides access control within the Mesh.
It allows you to define granular rules about which services can communicate with each other.
TargetRef support matrix
targetRef |
Allowed kinds |
---|---|
targetRef.kind |
Mesh , MeshSubset , MeshService , MeshServiceSubset |
from[].targetRef.kind |
Mesh , MeshSubset , MeshServiceSubset |
If you don’t understand this table you should read matching docs.
Configuration
Action
Kuma allows configuring one of 3 actions for a group of service’s clients:
Allow
- allows incoming requests matching the fromtargetRef
.Deny
- denies incoming requests matching the fromtargetRef
AllowWithShadowDeny
- same asAllow
but will log as if request is denied, this is useful for rolling new restrictive policies without breaking things.
Examples
Service ‘payments’ allows requests from ‘orders’
Explanation
-
Top level
targetRef
selects data plane proxies that implementpayments
service. MeshTrafficPermissionallow-orders
will be configured on these proxies. -
TargetRef
inside thefrom
array selects proxies that implementorder
service. These proxies will be subjected to the action fromdefault.action
. -
The action is
Allow
. All requests from serviceorders
will be allowed on servicepayments
.
Deny all
Explanation
-
Top level
targetRef
selects all proxies in the mesh. -
TargetRef
inside thefrom
array selects all clients. -
The action is
Deny
. All requests from all services will be denied on all proxies in thedefault
mesh.
Allow all
Explanation
-
Top level
targetRef
selects all proxies in the mesh. -
targetRef
inside the element of thefrom
array selects all clients within the mesh. -
The action is
Allow
. All requests from all services will be allow on all proxies in thedefault
mesh.
Allow requests from zone ‘us-east’, deny requests from ‘dev’ environment
Explanation
-
Top level
targetRef
selects all proxies in the mesh. -
TargetRef
inside thefrom
array selects proxies that have labelkuma.io/zone: us-east
. These proxies will be subjected to the action fromdefault.action
. -
The action is
Allow
. All requests from the zoneus-east
will be allowed on all proxies. -
TargetRef
inside thefrom
array selects proxies that have tagskuma.io/zone: us-east
. These proxies will be subjected to the action fromdefault.action
. -
The action is
Deny
. All requests from the envdev
will be denied on all proxies.
Order of rules inside the from
array matters.
Request from the proxy that has both kuma.io/zone: east
and env: dev
will be denied.
This is because the rule with Deny
is later in the from
array than any Allow
rules.