Introduction to Kubernetes Gateway API

Introduction to Kubernetes Gateway API In this post we are going to explore the new (or not so much) Gateway API in Kubernetes. What is Gateway API in Kubernetes? This API is an official Kubernetes Project that focus L4 and L7 routing in Ku


In this post we are going to explore the new (or not so much) Gateway API in Kubernetes.

What is Gateway API in Kubernetes?

This API is an official Kubernetes Project that focus L4 and L7 routing in Kubernetes. This project amis to represent the next generation of Kubernetes Ingress, Load Balancing, and Service Mesh APIs. This would be put in words like a “Ingress v2" API…

This API got GA in October 2023 and the project continues developing in a fast pace with a 170+ group collaborating in this regard.

Presentaton slides KubeCon 2023 presentation https://www.youtube.com/watch?v=V3Vu_FWb4l4&ab_channel=CNCF%5BCloudNativeComputingFoundation by Rob Scott & Nick Young

Why did Kubernetes needed a “Ingess v2”?

In the past years, the limitations and disadvantages of the original Ingress API were becoming apparent and the community started to build better and improved alternatives like Istio’s VirtualService API or Contour’s IngressRoute API. This arised the necessity for a new standard.

Some of the Ingress API problems includes…

Lowest Common Denominator Design:

  • The API key behavior was to garantee consistency across K8s clusters, regardless of the networking implementation. As a result, only the most esentiall features were introduced, so that every controller could supoport it.
  • Features like traffic splitting, header manipulation, canary releases, or detailed TLS configuration could not be captured in the “standard” API.
  • This also led to high Annotations dependency for any additional functionality. This generated divergent implementations, since each controller interprate the same annotation in its own way or even exposes entierly unique annotation-based features.

Single Resource for Everything

  • The Ingress resource encapuslates every configuration from routes, to tls configuration into the same Resource.
  • This makes difficult to separation of duties between, for example, developer and infraestructure team responsabilities.
  • Each of the personas (e.g., cluster operators, application developers, and networking operators) involved in the application, does not have a clear responsability scope.
  • This also makes overloaded resources.

Vague specifications and limited Extensibility

  • Since the Ingress resource lives on the core of Kubernetes code, it is attached and depends on the Kubernetes Release cycles. This didn’t allow the API to evolve quickly…
  • This slownes made new features to be implemented by the controllers. All the raw API limitations were “bypassed” by the Ingress Controller annotations. This caused more divergent features and fragmented configurations.
  • This also led to implementations differncies between this additional features.
  • The community started to see the rise of alternative APIs (e.g., Istio’s VirtualService, Contour’s IngressRoute) and thus a potential fork in the ecosystem.

Missing Concepts for Modern Use Cases

  • When the Ingress API was created features such as traffic shifting, deeper Layer 7 transformations, mutual TLS, or advanced retry policies were not part of the initial scope.
  • The ingress resource cannot express Mesh use cases, Multi-Cluster complexity and its highly HTTP focused leaving behind support for other protocols like TCP, gRPC or TLS passthrough for modern LB setups.

One of the biggest motivations behind creating the new Gateway API was the lack of true portability with the original Ingress resource. Although Ingress was intended as a portable interface, the minmal API surface, Controller-specific behaviors, high dependency on Annotations issues made it difficult to have consistent behavior across different environments and Controllers.

The new Gateway API (or “Ingress v2")

The new Gateway API developent aims to solve all the mentioned limitations in a long term fashion bringing:

  • Well-Defined, Layered Resources with separation of concerns and Clear Role Boundaries.
  • Expicit Extensibility with Release Channels versioning.
  • Mesh and Multi-Cluster use cases having the same API working for all.

Layered Resources

There are 3 main types of objects:

Presentaton slides KubeCon 2023 presentation https://www.youtube.com/watch?v=V3Vu_FWb4l4&ab_channel=CNCF%5BCloudNativeComputingFoundation by Rob Scott & Nick Young

GatewayClass:

  • As we previously have Ingress Controllers, in Gateway API we have GatewayControllers.
  • This controllers will define Gateways that share a common configuration and behavior.
  • GatewayClass is a cluster-scoped resource.
  • There must be at least one GatewayClass defined in order to be able to have functional Gateways.

Gateway:

  • Tells Kubernetes how to direct incoming traffic (whether from outside or inside the cluster) to the right Services.
  • It depends on a GatewayClass, which defines the actual load balancer or proxy underlying behavior.
  • Each gateway as Listeners.
Presentaton slides KubeCon 2023 presentation https://www.youtube.com/watch?v=V3Vu_FWb4l4&ab_channel=CNCF%5BCloudNativeComputingFoundation by Rob Scott & Nick Young
  • Each Gateway can connect to one or more Routes, which describe exactly how different parts of the traffic should be sent to specific Services.

Routes:

  • This resource defines de protocol-specific rules for mapping a Gateway listener traffic.
  • The Gateway-Routes relation can be one-to-one, one-to-many and many-to-one.
  • Below you’ll find the complete list of the route types available.

Roles and Personas

As mentioned, by design separations of concerns and role boundaries are a big topic in this new layered resources approach.

Originally, Kubernetes expected developers to manage everything about exposing their apps via Ingresses and Services. However, real-world clusters are shared by multiple teams with different needs. This raises a key challenge: how do you allow enough flexibility for those using the infrastructure while still giving owners control?

The Gateway API tackles this by defining different roles — each associated with a specific persona — so you can balance usability, flexibility, and control in a shared environment. Often, a single person may play multiple roles.

Infrastructure Provider

  • Manages the GatewayClass and GatewayController resource (defines the type of load balancer or proxy).
  • Sets up shared networking infrastructure for the cluster.

Platform Operator

  • Creates and configures Gateway resources based on the chosen GatewayClass.
  • In charge of cluster-wide network policies and higher-level configs.

Application Developer

  • Manages Route resources (e.g., HTTPRoute, TCPRoute) to direct traffic to their Services.
  • Focuses on application-specifics.

Existing Gateway Controllers implementations

As we mentioned, same as with Ingress, in Gateway API we have Gateway Controllers. There are a couple ongoing implementations here you can find the List — Kubernetes Gateway API controllers.

Here v1.2 — Kubernetes Gateway API you can find the features comparison for v1.2 release regarding the diferent Gateway profiles.

Overall Highlights of the Gateway API Controllers comparison

  1. Istio has the most comprehensive coverage for the Gateway Profile (HTTPRoute/GRPCRoute/TLSRoute) Extended features.
  2. Cilium consistently implements a very large subset of features in both Gateway and Mesh profiles, though it misses a couple that Istio has.
  3. Traefik and NGINX provide partial coverage — often including common features like rewriting paths, method matching, etc. — but do not implement all the Extended features.
  4. Kong demonstrates partial coverage in both of its modes for HTTPRoute and currently lacks Extended coverage for GRPCRoute and TLSRoute.

In other words, if you are looking for the “breadth” of v1.2 Gateway API Extended features, Istio and Cilium stand out as the most feature-complete among the listed implementations, with each covering slightly different corners in the Mesh profile.

Service Mesh support

Presentaton slides KubeCon 2023 presentation https://www.youtube.com/watch?v=V3Vu_FWb4l4&ab_channel=CNCF%5BCloudNativeComputingFoundation by Rob Scott & Nick Young

In the documentation you’ll find reference on the “GAMMA (Gateway API for Mesh Management and Administration) initiative” this refers to the group of people that is working on the Gateway API.

As the Initiative name “auto-explains”, these efforts focus on adding Mesh capabilities to the API, as one of the key goals of the API is to route traffic both east-west (mesh) and north-south (ingress), expanding its scope beyond traditional ingress use cases.

The Mesh support is on the Standard Channel since v1.1.0. The most significant change that GAMMA has introduced to date is that, when configuring a service mesh, individual route resources (such as HTTPRoute) are associated directly with Service resources. This is primarily because there will typically only be one mesh active in the cluster, so the Gateway and GatewayClass resources are not used when working with a mesh.

We are not going to go deep into the Mesh configurations in this post but you can read all the details here: Overview — Kubernetes Gateway API

No beta: release channels implementation

As we can see in the slide in the image, the authors of the API decided to not go for a Beta release approach.

Presentaton slides KubeCon 2023 presentation https://www.youtube.com/watch?v=V3Vu_FWb4l4&ab_channel=CNCF%5BCloudNativeComputingFoundation by Rob Scott & Nick Young

Instead they decided to implement a Release Channels approach.

Release channels are used to indicate feature stability within Gateway API. All new features and resources start in the Experimental release channel. From that point, these may graduate to the Standard release channel or be dropped from the API entirely.

Each new release of Gateway API is defined with a “bundle version” that represents the Git tag of a release, such as v1.0.0. This contains the following:

  • API Types (Go bindings for the resources)
  • CRDs (Kubernetes definitions of the resources)

Version Indicators

Each CRD will be published with annotations that indicate their bundle version and channel:

Bash
kubectl describe crd gateways.gateway.networking.k8s.io | grep channel
kubectl describe crd gateways.gateway.networking.k8s.io | grep bundle-version
Plain text
gateway.networking.k8s.io/bundle-version: v0.4.0
gateway.networking.k8s.io/channel: standard|experimental

Important: name confussion (API Gateway / Gateway API)

As explicitly mentioned in the documentation, an “API Gateway” is more like a general concept that describes any tool or service that can expose a backend service with traffic routing and manipulation capabilities, such as: load balancing, authentication, authorization or rate limiting.

The Gateway API in Kubernetes is a set of API types and CRDs that model a service networking in Kuberentes. As it explicited, provides a set of resources and objects like GatewayClasses, Gateway and Routes that allow to provide this functionality.

Most Gateway API implementations are API Gateways to some extent, but not all API Gateways are Gateway API implementations.

For example Apache APISix is an API Gateway:

Apache APISIX is an API Gateway implementation, not a direct implementation of Gateway API in Kubernetes. However, it supports Gateway API as an integration.

APISIX as an API Gateway

  • It is a full-featured API gateway that provides traffic management, authentication, rate limiting, security, and observability.
  • It can be deployed in Kubernetes or as a standalone API gateway.

Gateway API Support in Kubernetes

  • The Gateway API is a Kubernetes-native way of managing network traffic (similar to how Ingress works but more extensible).
  • Apache APISIX supports the Gateway API, meaning you can configure APISIX as a Gateway API controller in Kubernetes.
  • This allows APISIX to act as a Gateway implementation while leveraging Kubernetes-native resources.

Demo

In the next post we are going to go into the technical details and examples in order to get hands work with the Gateway API!

Documentation:

Thanks for reading. The learning continues in the next article.