Routing egress traffic via a gateway with the Kubernetes Gateway API
This section describes how to use the Kubernetes Gateway API to route outbound HTTP traffic through an egress gateway.
TOC
Prerequisites
- Alauda Service Mesh v2 Operator is installed.
- An Istio control plane is deployed.
Procedure
-
Create a namespace named
egress-gatewaywith the following command: -
Create a YAML file named
egress-gateway-cr.yamlthat defines the egress gateway.Example egress gateway CR file
Apply this YAML file by executing the following command:
-
Check the status of the gateway configuration by running this command:
The desired output is confirmed when the value in the
PROGRAMMEDcolumn isTrue.Example output
Verification
-
Create a namespace named
curlby executing the following command: -
Enable sidecar injection for the namespace. If your setup uses the
InPlaceupgrade strategy, run this command:NOTEIf you are using the
RevisionBasedupgrade strategy, execute these commands:-
To discover your
<revision-name>, run the following:Sample output:
-
Label the namespace using the revision name to enable sidecar injection:
-
-
Deploy the
curlapplication by running this command: -
Initialize and export a
CURL_PODenvironment variable containing the name of the curl pod: -
Using the
curlclient, confirm that you can reachhttpbin.orgvia the egress gateway by entering this command:The desired output will show a response from
httpbin.org, which indicates that the egress traffic is being routed through the configured gateway.Example output