This section describes how to use the Kubernetes Gateway API to route outbound HTTP traffic through an egress gateway.
Create a namespace named egress-gateway
with the following command:
Create a YAML file named egress-gateway-cr.yaml
that 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 PROGRAMMED
column is True
.
Example output
Create a namespace named curl
by executing the following command:
Enable sidecar injection for the namespace. If your setup uses the InPlace
upgrade strategy, run this command:
If you are using the RevisionBased
upgrade 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 curl
application by running this command:
Initialize and export a CURL_POD
environment variable containing the name of the curl pod:
Using the curl
client, confirm that you can reach httpbin.org
via 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