- Verify Istio control plane and ztunnel
- Create a test curl pod
- Deploy HelloWorld into the
hellonamespace - Enforce mTLS globally with PeerAuthentication
- AuthorizationPolicy differences: L3/L4 vs L7 in Ambient mode
- Configure the waypoint proxy for the
hellonamespace - 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):Create a test pod for issuing requests
Create a lightweight curl pod in thetest namespace to issue requests during the demo:
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:
Enforce mTLS globally with PeerAuthentication
Create a global PeerAuthentication in theistio-system namespace to enforce mTLS STRICT across the mesh.
Create global-pa.yaml:
test curl pod:
test pod is not yet participating in Ambient dataplane mode.
Example error:
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:
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
test namespace. Save as hw-auth-policy.yaml:
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:
test:
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. UsetargetRefs to point AuthorizationPolicy at a Service and principals to identify callers by mTLS identity (service account). Example hw-auth-policy-v2.yaml:
targetRefstargets thehelloworldService directly (L7 enforcement point expects explicit service targets).from.source.principalsuses the mTLS identitycluster.local/ns/<ns>/sa/<sa-name>instead of namespace selectors.
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 namespaceweb, 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.
web pod, curl the HelloWorld service:
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
defaultservice account. For least privilege and clearer policies, create dedicated service accounts for workloads and reference those inprincipals, 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.matchLabelsandnamespaces. 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=ambientto 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.
Links and references
- Istio Ambient Mode overview: https://istio.io/latest/docs/ops/deployment/ambient/
- AuthorizationPolicy reference: https://istio.io/latest/docs/reference/config/security/authorization-policy/
- PeerAuthentication reference: https://istio.io/latest/docs/reference/config/security/peer_authentication/
- Kubernetes Basics: https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/