Layer 7 features in ambient mode
Ambient mode provides stable L7 capabilities through the Gateway API HTTPRoute resource and the Istio AuthorizationPolicy resource.
The AuthorizationPolicy resource functions in both sidecar and ambient modes. In ambient mode, authorization policies can be targeted for ZTunnel enforcement or attached to a waypoint for waypoint enforcement. To attach a policy to a waypoint, include a targetRef that references either the waypoint itself or a Service configured to use that waypoint.
You can attach L4 or L7 policies to a waypoint proxy for identity-based enforcement. Once a waypoint is part of the traffic path, the destination ZTunnel identifies traffic by the waypoint's identity.
Istio peer authentication policies that configure mTLS modes are supported by ZTunnel. In ambient mode, policies that set the mode to DISABLE are ignored because ZTunnel and HBONE always enforce mTLS. For details, see Peer authentication (Istio documentation).
TOC
PrerequisitesRouting traffic using waypoint proxiesAdding authorization policyAdditional resourcesPrerequisites
- An active ACP CLI (
kubectl) session by a cluster administrator with thecluster-adminrole. - Istio is deployed in ambient mode.
- The Bookinfo sample application is deployed (for the following example).
- The waypoint proxy is deployed (for the following example).
Routing traffic using waypoint proxies
With a waypoint proxy deployed, you can split traffic between different versions of the Bookinfo reviews service for feature testing or A/B testing.
Procedure
-
Create the traffic routing configuration. Save the following as
traffic-route.yaml: -
Apply the traffic routing configuration:
Verification
Access the productpage service from within the ratings pod:
Most responses (80%) will contain reviews-v1 output, while a smaller portion (20%) will contain reviews-v2 output.
Example output
Clean up the routing configuration
Adding authorization policy
Use an L7 authorization policy to explicitly allow the curl service to send GET requests to the productpage service while blocking all other operations.
Procedure
-
Create the authorization policy. Save the following as
authorization-policy.yaml:- The
targetRefsfield specifies the service targeted by the authorization policy of the waypoint proxy.
- The
-
Apply the authorization policy:
Verification
-
Create a namespace for the curl client:
-
Deploy the curl client:
-
Add the
istio-discovery=enabledlabel to thecurlnamespace: -
Enable ambient mode for the
curlnamespace: -
Verify that a GET request to the
productpageservice succeeds with anHTTP 200response:Expected output
-
Verify that a POST request to the same service is denied with an
HTTP 403response:Expected output
-
Verify that a GET request from another service (such as the
ratingspod in thebookinfonamespace) is also denied withRBAC: access denied:Expected output
Clean up the verification resources
Additional resources
- Ambient mode architecture (Istio documentation)
- Peer authentication (Istio documentation)