Skip to main content
Welcome to demo two. In this walkthrough we take the first steps with the Gateway API and the NGINX Fabric Gateway implementation. You’ll deploy a simple app, expose it with a Kubernetes Service, create a Gateway that accepts *.example.com, and attach an HTTPRoute so external requests reach the app.
A presentation slide reading "Multi-Service Application Gateway" on the left and a large turquoise shape on the right with the word "Demo." A small "© Copyright KodeKloud" label appears in the bottom-left.

Application and Service

This demo uses a simple “coffee” application deployed as a Deployment and exposed via a ClusterIP Service named coffee. Key Service details:
  • Service name: coffee
  • Service port: 80
  • Target container port: 8080
  • Protocol: TCP
  • Service port name: http
Verify the Deployment and Service:

Gateway manifest

Create a Gateway to accept HTTP on port 80. The Gateway references a GatewayClass (nginx) so the underlying implementation (control plane + data plane) knows which controller to use. The listener restricts hostnames to *.example.com, allowing routes to match subdomains such as cafe.example.com.
Apply the Gateway and inspect status:
Example terminal output after creating the Gateway:
When the Gateway is created, the implementation spins up a data-plane pod (for example gateway-nginx-...) that receives translated configuration from the Gateway API control plane. Wait for that pod to reach Running before testing.
The Gateway’s hostname (for example *.example.com) limits which Host header / SNI values are accepted. Routes (HTTPRoute) that target a specific hostname like cafe.example.com must match a hostname allowed by the Gateway.

HTTPRoute manifest

Create an HTTPRoute that binds to the gateway listener (section http) and routes requests with the /coffee path prefix to the coffee Service on port 80.
Apply the HTTPRoute and verify the configured resources:
Example terminal output:

Testing with curl

In a local lab environment we often don’t have real DNS for cafe.example.com, so we use curl --resolve to override DNS and send the correct Host header. You can reach the Gateway either by port-forwarding the Gateway service to localhost or by hitting the NodePort exposed by the Gateway. Port-forward example (forward service port 80 to local 8080):
Then request the /coffee path while preserving the Host header:
Alternatively, target the NodePort shown in kubectl get svc (31437 in the example):
The Gateway implementation will accept the Host header cafe.example.com and route /coffee to the coffee Service. Successful request example (same curl command as above):
Example response body returned by the coffee application (fields vary by app):
If you request a path that does not match any configured route (for example /coffee123), the Gateway proxy returns a 404:
Example 404 response from the proxy (NGINX):

Quick resource summary

Summary

  • Deployed the coffee application and exposed it via a ClusterIP Service.
  • Created a Gateway that listens on HTTP port 80 and accepts *.example.com.
  • Attached an HTTPRoute for cafe.example.com and routed /coffee requests to the coffee Service.
  • Tested end-to-end routing locally with curl --resolve (or via NodePort / port-forward).
References

Watch Video

Practice Lab