Routing egress traffic via a gateway with the Kubernetes Gateway API in ambient mode
This guide demonstrates how to use the Kubernetes Gateway API together with a waypoint proxy to route outbound HTTP traffic through an egress gateway in ambient mode.
Prerequisites
- Alauda Service Mesh v2 Operator is installed.
- The
IstioandIstioCNIresources are configured with the ambient profile. - A
Ztunnelresource has been created. - Confirm Linux kernel compatibility.
Procedure
-
Create a namespace called
egress-gateway: -
Add the
istio-discovery=enabledlabel to theegress-gatewaynamespace: -
Enable ambient mode for the namespace by applying the dataplane mode label:
-
Create a YAML file named
egress-se.yamlthat defines aServiceEntryfor the external service. Theistio.io/use-waypointlabel associates this entry with the waypoint proxy.- Directs traffic for this
ServiceEntrythrough the waypoint proxy namedwaypointin the same namespace.
- Directs traffic for this
-
Apply the
ServiceEntry: -
Create a YAML file named
waypoint.yamlthat deploys a waypoint proxy in theegress-gatewaynamespace. The waypoint proxy intercepts and processes L7 traffic for services in this namespace.- The
istio.io/waypoint-for: servicelabel indicates that this waypoint processes traffic for services. The label value determines the type of traffic handled. For details, see Waypoint traffic types (Istio documentation). - Specifies the
istio-waypointgateway class, which deploys a waypoint proxy rather than a standard ingress gateway.
- The
-
Apply the waypoint proxy configuration:
NOTEAs an alternative to creating the YAML file manually, you can deploy the waypoint proxy using the following command:
When you use the
--enroll-namespaceoption, all services in theegress-gatewaynamespace (includingServiceEntries) will route their traffic through the waypoint.
Verification
-
Confirm the waypoint proxy is ready by checking its status:
The
PROGRAMMEDcolumn should displayTrue, indicating the configuration succeeded.Example output
-
Deploy the
curlclient in theegress-gatewaynamespace: -
Store the name of the
curlpod in a variable: -
From the
curlclient, verify that you can reachhttpbin.orgthrough the egress gateway:A successful response from
httpbin.orgconfirms that egress traffic is being routed through the configured gateway.Example output
The ztunnel logs should indicate traffic flowing through the waypoint, similar to the following output:
Example ztunnel log output
Cleanup
Remove the egress-gateway namespace and all associated resources: