The decoupling of the routes from the ingress allowed the introduction of multiple types of routes (L4 and L7) and will allow new routes to be introduced in the future. The Gateway API currently supports the following route types (at various levels of maturity, indicated in parentheses):
HTTPRoute (v1)GRPCRoute (v1alpha2)TLSRoute (v1alpha2)TCPRoute (v1alpha2)UDPRoute (v1alpha2)
In addition to these Routes, the Gateway API has added brand-new routing capabilities to enable users.
The Headers field in a HTTPRoute enables HTTP request header matching. Multiple match values are treated as an AND, meaning that a request must match all the specified headers to select the route.
HTTP Method matching
The Method field in an HTTPRoute specifies the HTTP verb to match. When specified, it will be matched only if the request has the specified method.
HTTP Query Parameters matching
The QueryParams field in an HTTPRoute specifies query parameters that must be present in the request. Multiple match values are treated as an AND, meaning that a request must match all the specified query parameters to select the route.
HTTP Route backend weights
The HTTPRoute backendRef Weight specifies the proportion of requests forwarded to the referenced backend. This is computed as weight/(sum of all weights in this BackendRefs list). If service A has a weight of 200 and service B has a weight of 100, ⅔ of the requests will go to service A.
HTTPRoute filters
HTTPRoute Filters are a way to specify additional behavior such as modifying request headers or enabling request mirroring when processing a route. There are different types of filters, and there is also the possibility to attach custom filters to the rule via an ExtensionRef field. This extension point may be used to attach Kong Plugins to the routes.
Cross-namespace references
As opposed to the Ingress API, it is now possible to reference objects in a cross-namespace fashion. There are two main use cases for this:
A Gateway and Route in Namespace A reference a service in Namespace B. This kind of reference is blocked by default and can be enabled through the ReferenceGrant API.
A Route in Namespace B configures a Gateway in Namespace C. This is also blocked by default, but can be enabled using the AllowedRoutes field.
Standardized way to add functionalities to the API
The Gateway API defines a standard way to customize and enrich API functionality through the PolicyAttachment specification. The first example of an API born from this specification is the BackendTLSPolicy, an API that aims at specifying the TLS configuration of the connection from the Gateway to a backend pod/s via the Service API object.
Migrating from Ingress to Gateway API
The Ingress API has been around for a long time. Migrating from Ingress to the Gateway API manually is a process that is time-consuming and error-prone. As the Ingress API is a subset of the Gateway API’s functionality, it is possible to convert resources programmatically. This is why we built ingress2gateway.
Ingress2gateway is primarily focused on translating Ingress and provider-specific resources (CRDs) to Gateway API resources. This project is provider-based, which means that any Gateway API implementation can contribute a provider to convert all the Ingress-related annotations and CRDs into Gateway API resources.
Kong has implemented its own provider with the following set of features properly translated from Ingress to Gateway:
- HTTPRoute header matching
- HTTPRoute method matching
- Plugin references conversion into HTTPRoutes ExtensionRef filters
- TCPIngress conversion to Gateway, TCPRoutes, and TLSRoutes
- UDPIngress conversion to Gateway and UDPRoutes
Try the Gateway API today
The Gateway API recently released v1.0.0 and general availability, which is getting a lot of attention. A v1 release is a suitable level of maturity for users to trust that the API is stable.
We believe that the Gateway API is the future of Kubernetes networking. For this reason, the Gateway API is the preferred way of configuring Kong with the latest Kong Ingress Controller version (v3.0.0).
To make getting started with the Gateway API straightforward, we’ve published a step-by-step guide for Kong Ingress Controller. You can get started in under 10 minutes.
To learn more about how to use the Gateway API, watch this video. It contains a demonstration of some features with an example built from scratch. All the manifests used in the tutorial can be found here.
Conclusion
The Gateway API is likely the most collaborative API in Kubernetes history, with representation from multiple vendors and many community members to ensure that it’s a standard that will endure for many years. With its GA release, the Gateway API is officially production-ready.
The entire Gateway API community is looking forward to hearing user feedback about this huge step forward in Kubernetes networking. Get started with the Kong Ingress Controller 3.0 today and let us know what you think.