In Service Mesh (ASM) ambient mode, the Ztunnel component loads its runtime configuration from the ztunnel-config ConfigMap in the istio-system namespace. The config.yaml field in this ConfigMap defines settings for egress policy, L7 observability, and other configurations. Ztunnel watches the file for changes and applies them automatically without a restart.
Configuration
The ztunnel-config ConfigMap has the following structure:
apiVersion: v1
kind: ConfigMap
metadata:
name: ztunnel-config
namespace: istio-system
data:
ztunnel-config.yaml: |
l7Config:
enabled: false
egressPolicies: [ ]
|
Field |
Type |
Required |
Description |
|
|
|
No |
Configuration for L7 observability. If not specified, default values are used. |
|
|
|
No |
Egress policy rules for traffic to services outside the cluster. If empty or not specified, all egress traffic is allowed by default. |
EgressPolicy configurations apply only to services outside the cluster. Services registered within the cluster, such as Service and ServiceEntry resources, are not affected.
Configuration examples
Example 1: Enable L7 access logs
Enable L7 access log generation. Ztunnel parses HTTP and TLS traffic and outputs access logs.
l7Config:
enabled: true
Example 2: Deny access to private CIDR blocks
Deny access from all namespaces to private CIDR blocks, without enabling L7 observability.
egressPolicies:
- matchCidrs:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
policy: Deny
Example 3: Enable L7 access logs and layered egress control
Enable L7 access logs combined with layered egress control: allow passthrough for a specific namespace, deny access to the metadata service on specific ports, and deny access to private CIDR blocks.
l7Config:
enabled: true
egressPolicies:
# Allow passthrough for the egress-gateway namespace to prevent the fallback rule from blocking the egress proxy itself.
- namespaces:
- egress-gateway
policy: Passthrough
# Deny access to the cloud provider's metadata service on ports 80 and 443.
- matchCidrs:
- 169.254.169.254/32
- fd00:ec2::254/128
matchPorts:
- 80
- 443
policy: Deny
# Deny access to private CIDR blocks.
- matchCidrs:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
- fc00::/7
policy: Deny
Field details
L7Config
|
Field |
Type |
Required |
Description |
|
|
|
No |
Enables L7 traffic observability. Default: |
-
L7 observability currently supports access log generation only. Request-level metric collection and distributed tracing are not yet supported.
-
The supported protocols are HTTP and TLS.
-
Enabling this feature can add approximately 5% performance overhead. Evaluate your workload requirements before enabling it.
Additional HTTP fields
When L7 observability is enabled, each HTTP request/response transaction generates a separate access log entry with the following additional fields:
|
Field |
Description |
Example value |
|
|
HTTP request method |
|
|
|
Request path |
|
|
|
Protocol version |
|
|
|
Request host |
|
|
|
HTTP response status code |
|
|
|
The |
|
|
|
Size of the request body in bytes, per request |
|
|
|
Size of the response body in bytes, per request |
|
|
|
Total time for a single request, from when it is sent until the response is received |
|
Additional TLS fields
When L7 observability is enabled for TLS traffic (not HTTP over TLS), Ztunnel parses the ClientHello handshake message and adds the following fields to the log entry:
|
Field |
Description |
Example value |
|
|
Fixed value |
|
|
|
The Server Name Indication (SNI) from the ClientHello message |
|
|
|
The first Application-Layer Protocol Negotiation (ALPN) protocol from the ClientHello message. If no ALPN is specified, the value is |
|
EgressPolicy
Each EgressPolicy rule consists of three match conditions (namespaces, matchCidrs, and matchPorts) and a policy action. Ztunnel evaluates rules from top to bottom and applies the first rule whose conditions all match.
|
Field |
Type |
Required |
Description |
|
|
|
No |
A list of client namespaces to which the rule applies. If empty, it matches all namespaces. |
|
|
|
No |
A list of destination IP address ranges in CIDR format. If empty, it matches all destination IP addresses. To control both IPv4 and IPv6 traffic, you must configure their respective CIDR ranges separately. |
|
|
|
No |
A list of destination ports. If empty, it matches all ports. |
|
|
|
Yes |
The action to take. Valid values are:
|
EgressPolicyAction
The following values are available for the policy field:
|
Value |
Description |
|
|
Forwards traffic directly to the destination IP address over TCP, bypassing the mesh proxy. |
|
|
Immediately drops the request, preventing it from reaching the destination. |
Configuration constraints
-
Ztunnel evaluates rules in
egressPoliciesin order and applies the first rule whosenamespaces,matchCidrs, andmatchPortsconditions all match. Subsequent rules are ignored. -
The
namespacesfield matches the namespace of the client (the source of the request), not the namespace of the destination service. -
The
matchCidrsfield matches the destination IP address, not the domain name. To control traffic based on domain names, you must register the external service as aServiceEntryin the mesh. -
The
matchPortsfield matches the destination port (the remote port of the request), not the client's source port. -
If a request matches no rules in
egressPolicies, the default action isPassthrough. -
Ztunnel automatically loads configuration changes through file-watching, without requiring a pod restart. If the configuration format is invalid, Ztunnel retains the last known good configuration.