Skip to main content
This lesson demonstrates how Istio Ambient mode interacts with workload security (mTLS via PeerAuthentication and L3/L4 vs L7 AuthorizationPolicy enforcement). Ambient mode behavior is similar to traditional sidecar-mode flows but introduces important differences—most notably the waypoint proxy that enforces L7 policies. This guide is a hands-on demo for learning and experimentation. Prerequisites: a running Kubernetes cluster with Istio installed and Ambient mode enabled. Table of contents
  • Verify Istio control plane and ztunnel
  • Create a test curl pod
  • Deploy HelloWorld into the hello namespace
  • Enforce mTLS globally with PeerAuthentication
  • AuthorizationPolicy differences: L3/L4 vs L7 in Ambient mode
  • Configure the waypoint proxy for the hello namespace
  • AuthorizationPolicy for Ambient mode (targetRefs + principals)
  • Validate with a non-allowed namespace
  • Notes about service accounts and principals
  • Cleanup
  • Summary
  • Links and references

Verify Istio control-plane and ztunnel

Confirm Istio control-plane components are running (ztunnel, istiod, CNI):
Ensure ztunnel is present — it handles Ambient mode data-plane enforcement (L3/L4 mTLS).

Create a test pod for issuing requests

Create a lightweight curl pod in the test namespace to issue requests during the demo:
This pod will act as a simple client for verifying connectivity and enforcement behavior.

Deploy the HelloWorld app into the hello namespace

From your demo directory (contains helloworld.yaml), label the hello namespace for Ambient dataplane mode and apply the manifest:
Verify deployments and service:

Enforce mTLS globally with PeerAuthentication

Create a global PeerAuthentication in the istio-system namespace to enforce mTLS STRICT across the mesh. Create global-pa.yaml:
Apply it and confirm:
Now attempt to access HelloWorld from the test curl pod:
You will likely see a connection reset because mTLS is enforced and the test pod is not yet participating in Ambient dataplane mode. Example error:
Explanation: the hello namespace is labeled for Ambient mode but test is not. Ambient-mode enforcement expects the caller to be an ambient participant (or otherwise use mTLS-capable client identities). Label the test namespace for Ambient mode:
Retry the request:
In Ambient mode, mTLS enforcement is handled by the ztunnel at the dataplane layer. For successful communication, both caller and callee namespaces should be labeled with istio.io/dataplane-mode=ambient (or the client must present mTLS identity).

Authorization policies: layer-3/4 vs layer-7 differences

Ambient mode separates responsibilities:
  • L3/L4 (identity, mTLS) — enforced by ztunnel
  • L7 (HTTP route/method-level rules) — enforced by the waypoint proxy
This means AuthorizationPolicy behavior differs from sidecar mode. A policy that appears to be an L7 rule but lacks a configured waypoint or uses non-ambient constructs may be ignored or produce connection errors. Example: create a basic AuthorizationPolicy that attempts to allow only GET/HEAD from the test namespace. Save as hw-auth-policy.yaml:
Apply it:
If you curl from test now, you may still get a connection reset or a 503. Why? Because the policy above is an L7 rule that relies on the waypoint to enforce route-level methods. Without a waypoint configured for the hello service, Ambient mode cannot reliably enforce this L7 policy and traffic may be rejected.

Configure the waypoint proxy for the hello namespace

Apply a waypoint for the hello namespace and label the namespace to use it:
Check pods to see the waypoint pod starting:
Label the namespace to use the waypoint:
Retry the curl from test:
A 503 indicates the request is reaching the waypoint Envoy, but the L7 enforcement point is rejecting the request. This commonly happens because the AuthorizationPolicy is not expressed in a form Ambient mode expects for L7 enforcement.
When you enable a waypoint for L7 enforcement, ensure AuthorizationPolicy targets and identity principals are expressed explicitly. Using namespace selectors alone often does not work for L7 in Ambient mode.

AuthorizationPolicy for Ambient mode: use targetRefs + principals

Ambient mode follows a zero-trust, explicit model for L7 policies. Use targetRefs to point AuthorizationPolicy at a Service and principals to identify callers by mTLS identity (service account). Example hw-auth-policy-v2.yaml:
Key differences from the earlier policy:
  • targetRefs targets the helloworld Service directly (L7 enforcement point expects explicit service targets).
  • from.source.principals uses the mTLS identity cluster.local/ns/<ns>/sa/<sa-name> instead of namespace selectors.
Apply the v2 policy and verify:
Retry from the test curl pod (default service account default in test namespace). It should now succeed:

Validate the policy by testing from a non-allowed namespace

Create a new namespace web, label it for Ambient mode, and run an nginx pod. This pod will use the default service account in web, which is not allowed by the policy above.
From the web pod, curl the HelloWorld service:
The 403 response indicates the incoming principal (e.g., cluster.local/ns/web/sa/default) is not allowed by the AuthorizationPolicy, which explicitly allowed only cluster.local/ns/test/sa/default.

Notes about service accounts and principals

  • Every namespace has a default service account. For least privilege and clearer policies, create dedicated service accounts for workloads and reference those in principals, for example: cluster.local/ns/<ns>/sa/<service-account>.
  • Prefer targetRefs (Service) + principals (service account identity) for L7 AuthorizationPolicy in Ambient mode. This pattern aligns with Ambient mode’s explicit, identity-based enforcement.
  • In sidecar mode, policies commonly use selector.matchLabels and namespaces. Ambient mode shifts L7 policy expression to service-targeted, identity-based constructs, enforced by the waypoint.

Quick comparison: Sidecar mode vs Ambient mode (L7 enforcement)

Cleanup (optional)

To remove demo resources:

Summary

  • Label namespaces with istio.io/dataplane-mode=ambient to participate in Ambient dataplane features.
  • Enforce mTLS via PeerAuthentication; ensure both caller and callee can perform mTLS.
  • For L7 AuthorizationPolicy in Ambient mode:
    • Configure a waypoint for the target namespace/service.
    • Prefer targetRefs + principals (service account-based mTLS identities) over namespace selectors.
  • Ambient mode separates L3/L4 enforcement (ztunnel) from L7 (waypoint) — this changes how policies need to be expressed. Expect behavior to evolve as Ambient mode matures.

Watch Video

Practice Lab