In this lesson we demonstrate how Istio Ambient mode affects workload security, mTLS enforcement, and AuthorizationPolicy behavior. You’ll see how namespace labeling, PeerAuthentication, waypoints, and SPIFFE principals interact in Ambient mode. The flow:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Verify Istio control-plane components (including
ztunnelused by Ambient mode). - Deploy a long-running curl client in the
testnamespace. - Deploy a HelloWorld app in a
hellonamespace, label it for Ambient mode, and enforce global mTLS with a PeerAuthentication. - Show how namespace labeling affects connectivity under mTLS in Ambient mode.
- Demonstrate how layer‑7 AuthorizationPolicy requires a waypoint in Ambient mode and why policies should use service-account principals (SPIFFE) instead of namespace-based sources.
Verify Istio control-plane and create a test pod
First, ensure the Istio control plane and Ambient components are running. In Ambient mode you should see aztunnel pod in the istio-system namespace:
test namespace to act as a client:
Deploy HelloWorld into a namespace labeled for Ambient mode
From your demo folder, label thehello namespace for Ambient dataplane mode and apply the HelloWorld manifest (helloworld.yaml):
Enforce global mTLS (PeerAuthentication)
Create a cluster-wide PeerAuthentication inistio-system to require strict mTLS:
Test connectivity from the test pod
Try to reach the HelloWorld service from the curl pod in the test namespace:
- The
hellonamespace is labeled for Ambient mode and is subject to strict mTLS. - The
testnamespace is not labeled for Ambient mode and therefore is not participating in the Ambient dataplane (ztunnel identity/mTLS path). The identity/mTLS mismatch results in a connection reset.
test namespace for Ambient:
curl pod:
Namespaces that should participate in Istio Ambient features must be labeled with
istio.io/dataplane-mode=ambient. Without this label, Istio’s Ambient dataplane (ztunnel identity, mTLS path, etc.) will not be used and connectivity requiring mTLS will fail.AuthorizationPolicy in Ambient mode — layer‑7 requires a waypoint
Layer‑7 (HTTP) AuthorizationPolicy enforcement in Ambient mode is performed by a waypoint proxy. A sidecar-style, namespace-based AuthorizationPolicy that relies on source namespaces will not behave the same in Ambient mode for L7 rules. Create a namespace-based policy (sidecar-like) that attempts to allow GETs from thetest namespace:
curl pod:
- The policy contains layer‑7 HTTP rules. In Ambient mode, L7 enforcement happens at the waypoint proxy, which is the L7 enforcement point.
- Without configuring a waypoint for the namespace, the enforcement point and routing expected by the policy are not in place, so the request can result in a
503 Service Unavailableas the waypoint-based path is not available or not allowing the request.
test pod:
503 now indicates that layer‑7 authorization is being evaluated at the waypoint, and the current AuthorizationPolicy does not grant the request. In Ambient mode you must be more explicit about principals.
Use service-account principals (SPIFFE) in AuthorizationPolicy for Ambient
In Ambient mode, AuthorizationPolicy should reference exact principals (service accounts) using the SPIFFE format rather than relying solely on namespaces. Create a policy that allows traffic only from thedefault service account in the test namespace using the SPIFFE principal format cluster.local/ns/<namespace>/sa/<serviceaccount>:
- Every namespace has a
defaultservice account unless you explicitly create or replace it. In production, create specific service accounts per workload for least privilege. - Using SPIFFE principals gives precise control over allowed workload identities.
curl pod (which uses the default SA in test):
cluster.local/ns/test/sa/default is explicitly allowed.
Verify denying other namespaces / service accounts
Create a new namespaceweb, label it for Ambient, and attempt the same request from a pod there. The default SA in web has a different SPIFFE principal and should be denied by the above policy:
403 Forbidden because the request principal (cluster.local/ns/web/sa/default) is not allowed by hello-world-authz-v2.
If you remove the AuthorizationPolicy, access will be allowed again (assuming mTLS and dataplane labels are correct):
Recap and best practices
- Label namespaces with
istio.io/dataplane-mode=ambientso workloads participate in the Ambient dataplane (ztunnel). - Enforce mTLS cluster-wide with a PeerAuthentication (e.g.,
mtls: STRICT). Non-ambient namespaces will fail to connect to ambient workloads if they are not labeled to participate. - Layer‑7 (HTTP) AuthorizationPolicy enforcement in Ambient mode uses a waypoint proxy; install a waypoint and label the namespace (
istio.io/waypoint=enabled) to enable waypoint-based L7 enforcement. - In Ambient mode, AuthorizationPolicy should be written to match exact principals (SPIFFE identities) instead of relying solely on source namespaces:
- Use principals in this format:
cluster.local/ns/<namespace>/sa/<serviceaccount>.
- Use principals in this format:
- For production, create and use distinct service accounts per workload (avoid using
default) so policies can be precise and follow least-privilege principles.
| Topic | Recommendation | Example |
|---|---|---|
| Namespace participation | Label for Ambient dataplane | kubectl label namespace hello istio.io/dataplane-mode=ambient |
| mTLS enforcement | Use global PeerAuthentication (STRICT) | See global-pa.yaml above |
| L7 enforcement | Install and enable waypoint for the namespace | istioctl waypoint apply -n hello and kubectl label namespace hello istio.io/waypoint=enabled |
| AuthorizationPolicy identity | Use SPIFFE principals (service accounts) | cluster.local/ns/test/sa/default |
Summary: Ambient mode changes identity and policy semantics compared to sidecar mode. Label namespaces to participate in the ambient dataplane, use waypoints for L7 enforcement, and author AuthorizationPolicy rules using SPIFFE principals (service accounts) for precise access control in a zero‑trust model.
Links and references
- Istio Ambient mode concepts: https://istio.io/latest/docs/ops/deployment/ambient/
- PeerAuthentication reference: https://istio.io/latest/docs/reference/config/security/peer_authentication/
- AuthorizationPolicy reference: https://istio.io/latest/docs/reference/config/security/authorization-policy/
- Waypoint proxies: https://istio.io/latest/docs/setup/additional-setup/waypoint/
- SPIFFE standard: https://spiffe.io/