What You Need to Know about the Kubernetes Gateway API

Jump into the API Gateway and Why we need it

The Kubernetes Ingress resource links external requests to services in Kubernetes clusters. By specifying routes within the resource, developers utilize Ingress resources to make their services and APIs accessible. Native Ingress has been around for years and is widely used, but its capabilities are limited to the most basic routing needs.

Only the path and host specified in the request can grant access to services via Native Ingress. DevOps and developers depend on suppliers providing Ingress controllers to implement sophisticated traffic routing logic. To expand the functionality of Ingress, vendors employed proprietary annotations, rendering Ingress configurations incompatible with other Ingress controllers or implementations. Multiple teams find it onerous to work on a single Ingress resource because of the annotations, which make Ingress challenging to maintain.

The Kubernetes Gateway API addresses the lack of standardization with Ingress and the proliferation of vendor-specific annotations. The “next-generation Ingress” Gateway API offers sophisticated functionality right out of the box without needing extra annotations.

What is the Gateway API for Kubernetes?

Essential to complex ingress rules can be configured using the Kubernetes Gateway API, a vendor-neutral, Kubernetes-native custom resource. The Gateway API project is overseen by the Kubernetes SIG (Special Interest Group) Network.

Platform teams, DevOps, and developers can utilize the Gateway API independently. It contains GatewayClass, Gateway, and protocol-specific Route CRDs.

  • The controller used to implement the Gateway API resources is specified by the GatewayClass.
  • The gateway resource serves as a network endpoint, guiding external traffic into the cluster. A GatewayClass has a gateway associated with it.
  • For requests from the gateway to the backend service, route objects specify protocol-specific (HTTP, TCP, UDP, gRPC) or TLS traffic routing rules. Gateways are connected to route resources.
  • Secure cross-namespace reference in a Kubernetes cluster is made possible by ReferenceGrant.

Diagram – Kubernetes API

Gateway APIs, such as Ingress, use custom resource definitions (CRDs) to represent routing configurations. A specialized controller is needed to comprehend and convert these CRDs into applicable configurations for the underlying infrastructure. The open-source Traefik Proxy v3 is an intrusion controller with integrated support for the Gateway API.

Gateway API vs. Ingress

IngressGateway API
Traffic RoutingThere is no native support for complex or essential HTTP routing functions.Various backend kinds, typed routes, traffic balancing, and header-based matching.
ExtensibilityObtained using vendor-specific methods and custom annotations.It gives consumers the ability to specify their unique resources.
StandardizationInconsistent individual implementations among various Ingress controllers.A universal specification that works with different implementations.
Role-Based Access ControlDoes not allow for the native management of various configuration portions by distinct teams.It allows teams to control their traffic while cluster operators establish the rules.
Protocol SupportSeveral Kubernetes resources are required to make non-HTTP services available online.Extensive support for protocols.
SecurityTLS termination support at a basic level.Enables the cluster operators’ defined additional security controls in general.

Pros of implementing Kubernetes Gateway API

IT teams gain significantly from Gateway API resources instead of Kubernetes’ Ingress API. The following are some advantages of using the Kubernetes Gateway API.

  • Innovative advanced traffic management

With the help of the expressive Gateway API resources, developers may set up sophisticated routing rules without needing extra annotations. For instance, developers can establish two backends and route traffic according to specific weights using HTTPRoute resources. The K8s Gateway API’s expressiveness makes it simple for developers to implement advanced traffic management techniques like A/B testing, blue-green rollout, and canary deployment.

Developers can read HTTP request data and make in-flight modifications for granular routing using the Gateway API. A request can be compared to the request data’s hostname, path, and header combination for advanced routing. Before sending a request to the backend service, the request headers can also be changed, for example, to conceal authorization tokens or other sensitive data.

The Gateway API has all of the functionalities mentioned above built-in, and developers can use specific Route resources to customize them for both L4 and L7 queries.

  • Portable Ingress configuration across a variety of implementations

Both simple and complex Ingress setups are standardized via the Kubernetes Gateway API. This implies that IT teams can utilize the identical Gateway API setups regardless of the underlying controller and that Ingress configurations are transferable between controllers.

If the team wishes to experiment with or switch to a different controller, the Gateway API’s portability helps to future-proof their Ingress configuration. There won’t be much of a learning curve to embrace the new controller if it supports Gateway API, and the team won’t need to update the Gateway API settings (apart from GatewayClass).

In addition to standardizing most configurations used in a production environment, the Gateway API offers sufficient flexibility for users and vendors to expand the specification.

  • Clearly defined areas of concern and smooth RBAC

With the Gateway API, IT teams manage Ingress configuration resources according to their roles: DevOps engineers set up Gateway instances and permit developers to attach different routes to their applications; platform teams set up the GatewayClass and do not need to allow DevOps to change it while granting access to attach Gateway resources referencing that class.

The Gateway API’s role-based CRD model facilitates the division of responsibilities among various organizational roles. It guarantees that no role or team will alter the regulations another function or team upholds. Platform teams can use this approach to define uniform access control using Role and ClusterRole resources (RBAC).

  • Safe routing and referencing between namespaces

Cross-namespace reference is made possible by the ReferenceGrant object in the Gateway API, which aids in separating ingress rules from the services. The resource enables IT teams operational flexibility by allowing them to deploy and operate Route resources in designated namespaces independently. Understand the sample below to understand how ReferenceGrant handles secrets as well.

Because the owner of the service or secrets must construct a RefereGrant object and specifically permit the reference outside its namespace, the ReferenceGrant resource also improves security. The operation of cross-namespace reference requires this “approval.” Since the service or secret owners control who may access their resources, it gives them additional authority.

Drawbacks of using the Kubernetes Gateway API

  • Installation and Version Compatibility: The Kubernetes Gateway API is less intuitive right out of the box than Ingress, which is plug-and-play. Even though this might seem inconvenient, remember that these issues will probably be resolved when the Gateway API is developed.
  • Multiple Object Structure: There is more than one component to the Kubernetes Gateway API. It comprises multiple distinct components, each having a unique structure. Although this intricacy provides more scalability and precise control, it may not be very comforting to novice users.
  • Time Investment and Learning Curve: You’ll need to learn how to combine the Gateway API’s many parts to deploy it successfully. The intricate structure of the API also calls for a greater comprehension of the complexities of Kubernetes.
  • Overkill for Simple Requirements: The Kubernetes Gateway API may be more than you need for smaller businesses. Its sophisticated features meet the demands of big, intricate businesses. Nevertheless, even if your needs are now small, don’t discount the Gateway API. As your company expands and your needs become more complicated, the Gateway API may provide the flexibility and scalability you demand.

Cloud InterviewACE.

The best way to pass the Cloud Computing interviews. Period.

Cloud InterviewACE is an online training program & professional community mentored by industry veteran Joseph Holbrook (“The Cloud Tech Guy“), a pre/post sales guru in cloud. 

Learn to pass the technical and even soft skills interviews from the starting basics to advanced topics covering presales, post sales focused objectives such cloud deployment, cloud architecting, cloud engineering, migrations and more. resume tips, preparation strategy, common mistakes, mock interviews, technical deep-dives, must-know tips, offer negotiation, and more. AWS, GCP and Azure will be covered. 

Find out more about CloudInterviewACE

Fast-track your career now!  

This changes your world, what are you waiting for!

Affiliate Disclosure

We love that you’re enjoying the cool stuff here.

Our legal consultant tells us we should let you know that you should assume the owner of this website is an affiliate for people, business who provide goods or services mentioned on this website and in the videos or audio.

The owner may be compensated and should be if you buy stuff from a provider.

That said, your trust means everything to us and we don’t ever recommend anything lightly. Thank you