What Is Kubernetes Gateway API? Configure Traffic with Gateway and HTTPRoute
Kubernetes Gateway API is an extensible family of APIs for declaring how network traffic enters a cluster and reaches Services. A controller from a Gateway API implementation must be installed before the declarations create real network configuration. Its core structure separates responsibilities among the `GatewayClass` selected by an infrastructure operator, the `Gateway` configured by a cluster operator, and the `HTTPRoute` attached by an application owner.
How does Gateway API differ from Ingress?
A basic Ingress places HTTP/HTTPS rules for connecting hosts and paths to Services in one resource. Gateway API separates the infrastructure that accepts traffic from application routes attached to that infrastructure, using Gateway and HTTPRoute. This makes it easier for several teams to share an entry point: an operations team can manage allowed listeners and route scope while application teams deploy their own Routes.
Gateway API does not remove Ingress. Kubernetes continues to provide Ingress, although development of that API is frozen; Gateway API is a successor API intended for role separation and more expressive rules. If existing Ingress meets your needs, you do not have to migrate immediately. Consider Gateway API for a new design when you need delegation across teams, header- or weight-based routing, or a shared API for supported configuration. Greater expressiveness does not mean every implementation supports every feature.
How do the resources fit together?
Gateway API consists of GatewayClass, Gateway, Routes for different protocols, and policy resources they reference. This article focuses on GatewayClass, Gateway, HTTPRoute, and a Service backend, the pieces needed to understand an HTTP entry path. Check the Standard or Experimental channel for each resource and field in the Gateway API bundle and implementation version you install.
| Resource | Main responsibility | Operational meaning |
|---|---|---|
GatewayClass | Selects which controller implementation manages a class of Gateways | Usually created by an infrastructure provider or cluster operator; the class name and capabilities depend on the implementation. |
Gateway | Declares listeners, protocols, ports, hostnames, and which Routes may attach | A controller can use it to configure a data path such as a load balancer or proxy and may report an address. |
HTTPRoute | Connects request conditions such as hostname, path, or header to a backend Service | An application owner attaches it to a Gateway with parentRefs, and it must also satisfy the listener's allowed attachment rules. |
A typical request follows this path:
Client → DNS and Gateway address → Gateway listener → HTTPRoute rules → backend Service:port → ready PodGatewayClass selects a Gateway type and controller; Gateway defines the listener boundary; HTTPRoute describes which requests go to which Service through that boundary. Creating only a Gateway or only a Route does not complete external access. A controller must be installed, the Route must be accepted by the Gateway, and the backend Service and endpoints must be ready.
How does a Route attach to a Gateway?
For a Route to attach, its HTTPRoute.spec.parentRefs must reference the Gateway. A Gateway listener must also allow that Route kind and namespace. If the listener and Route both specify hostnames, they must have at least one hostname in common. parentRefs is the application owner's request for exposure; allowedRoutes is the Gateway operator's control over what it accepts. Both sides must agree before the route is configured.
By default, a Gateway listener accepts Routes only from its own namespace. If a shared Gateway should accept Routes from teams in other namespaces, constrain allowedRoutes.namespaces with a Selector and namespace labels when possible; this is easier to govern than allowing All without limits. That setting governs permission to attach a Route to the Gateway. Permission for a Route to reference a Service backend in another namespace is a separate matter: the target namespace needs a ReferenceGrant. Do not confuse these two boundaries.
Example: send /catalog requests through a shop Gateway to an existing Service
The example declares a Gateway and HTTPRoute in the shop namespace in one file. Before applying it, install the Gateway API CRDs and a controller that implements them. example-gateway-class is a placeholder, not a real class name; replace it with a class from a supported implementation shown by kubectl get gatewayclass. The web Service in namespace shop must expose port 8080 and have ready endpoints. This example configures an HTTP listener only; it does not configure TLS termination. Before using a public service, design an HTTPS listener in line with the selected implementation's documentation and your security requirements. This manifest and the commands are illustrative and have not been applied to a cluster.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: shop-edge
namespace: shop
spec:
gatewayClassName: example-gateway-class
listeners:
- name: web
protocol: HTTP
port: 80
hostname: shop.example.com
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: shop-web
namespace: shop
spec:
parentRefs:
- name: shop-edge
hostnames:
- shop.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /catalog
backendRefs:
- name: web
port: 8080The listener accepts HTTP for shop.example.com and restricts attachment to HTTPRoutes in the same namespace. The Route sends requests with that hostname and the /catalog path to the web:8080 Service. PathPrefix matches complete path elements separated by /, with case sensitivity; it is not an arbitrary text prefix. Thus /catalog/item matches but /catalogue does not. The rule does not automatically remove /catalog from the request URL, so check that the application can handle the original path, such as /catalog/item. DNS must point to the address reported for the Gateway by the implementation. See the PathPrefix definition in the HTTP route API specification.
How do you install it and verify attachment?
Gateway API resources are Custom Resource Definitions (CRDs), not built-in Kubernetes kinds. Follow the selected implementation's installation instructions to prepare the CRDs and controller. Supported Gateway API versions, Route kinds, extended features, and address assignment differ among implementations, so do not copy installation commands from one implementation to another.
Before applying the example, check the current context, CRDs, GatewayClass, backend Service, and endpoints. These commands are examples and have not been run.
kubectl config current-context
kubectl api-resources --api-group=gateway.networking.k8s.io
kubectl get gatewayclass
kubectl get service web -n shop
kubectl get endpointslice -n shop -l kubernetes.io/service-name=web
kubectl apply -f <shop-gateway-api.yaml>
kubectl get gateway,httproute -n shop
kubectl describe gateway shop-edge -n shop
kubectl describe httproute shop-web -n shopCheck that the GatewayClass was accepted by its controller, that the Gateway was accepted and programmed, and that the HTTPRoute parent status has Accepted=True. If the Route reports ResolvedRefs=False, the referenced Service or port may be missing or a reference policy may block it. Read the actual condition types and reasons, then inspect the Gateway address, controller events and logs, and the Service EndpointSlice to isolate the failing layer. The fact that a resource appears in kubectl get does not prove traffic is flowing.
If the controller reports an address and DNS is ready, send a test request with the Host and the actual Gateway address. The following command is for an IPv4 or IPv6 address; replace GATEWAY_IP with the IP reported by the implementation. If the implementation reports a hostname, choose a test path that matches how that hostname resolves.
curl --resolve shop.example.com:80:$GATEWAY_IP http://shop.example.com/catalog/itemVerify success by checking both the expected backend response and the controller logs. curl --resolve temporarily specifies name resolution for that request only; it does not change the actual DNS record. The example uses plaintext HTTP. For an actual public service, configure and verify a TLS listener and certificate separately.
How do you assess feature support?
Gateway API defines support levels—Core, Extended, and implementation-specific—and provides conformance tests to improve consistency across implementations. Core describes the common behavior expected across implementations. Extended features are defined in the standard API but may not be supported by every controller. Vendor-specific annotations and extensions may behave differently when you change controllers. So the statement “supports Gateway API” alone does not establish support for every filter, TLS behavior, or Route kind you need.
Check supportedFeatures published in the chosen GatewayClass status, plus the implementation's version-specific conformance reports and feature matrix. If a GatewayClass reports support for HTTPRoute, that means its Core features; check named support for any required Extended features. If a required feature is unavailable, do not assume an annotation provides an equivalent portable behavior. Choose a supported implementation-feature combination or adjust the requirement.
When should you keep Ingress or move to Gateway API?
| Situation | Decision criteria |
|---|---|
| Current Ingress handles the required host/path rules and its controller is supported | Keeping it is reasonable. There is no need to rush a working Ingress; weigh the cost and risk of changing live resources. |
| Several teams share an entry point and Routes must be controlled by namespace and hostname | Gateway API makes role delegation explicit when you need listener and Route attachment rules. Design allowedRoutes and hostname constraints to match namespace policy. |
| You need a specific feature such as header, weighted, or protocol-specific routing | Confirm that the chosen GatewayClass implementation supports it in the API version you use. Do not infer portability from a feature name alone. |
| Your Ingress relies on controller-specific annotations | A move does not automatically preserve their effects. Review each annotation for a standard filter or policy, and identify implementation-specific alternatives and behavior changes. |
Ingress and Gateway API use different resource models. Kubernetes describes Gateway API as the successor to Ingress, but Gateway API does not include the Ingress kind. A real migration means designing new GatewayClass, Gateway, and Route resources and verifying behavior feature by feature. Instead of switching traffic all at once, prepare a parallel test and rollback plan that checks addresses, TLS, allowed Route scope, and backend responses.
References
Kubernetes Gateway API concepts, resource model, request flow, and Ingress migration
Gateway API resources and role model
HTTPRoute rules, backend references, and status
Core, Extended, implementation-specific features, and conformance
How to inspect features supported by a GatewayClass
PathPrefix definition for HTTP path matching
Scope: HTTP traffic model using gateway.networking.k8s.io/v1, GatewayClass/Gateway/HTTPRoute relationships, listener attachment, Service backends, feature support, and comparison with Ingress, based on documentation checked 2026-11-23. Separate GRPC, TLS, TCP, and UDP Route configurations are outside the worked-example scope. The class name, domain, and Service are illustrative; CRD/controller installation and requests were not performed. Check version-specific documentation for the selected Gateway API bundle and implementation.