kgateway: An amazing tool to simplify traffic management using Kubernetes API Gateway

Kgateway is a feature-rich, fast, and flexible Kubernetes-native ingress controller and next-generation API gateway. Built on top of the robust Envoy proxy and the Kubernetes Gateway API, Kgateway acts as a reverse proxy, providing a crucial security barrier between your clients and the microservices that constitute your application. Think of it as the bouncer at the club, but instead of checking IDs, it verifies and routes requests to the appropriate microservice.

Kgateway's Superpowers

Kgateway isn't just another API gateway; it's fully compliant with the Kubernetes Gateway API and extends its functionality with custom Gateway APIs like RoutePoliciesListenerPolicies, and Backends. These resources allow for centralized configuration of advanced traffic management, security, and resiliency rules for an HTTPRoute or Gateway listener. In simpler terms, Kgateway gives you more control and flexibility over how traffic flows through your Kubernetes cluster.

Extensions and integrations

The kgateway project offers a range of extensions on top of the Kubernetes Gateway API, enabling advanced routing, security, and resiliency capabilities. Some of these extensions include:

Default Gateway Proxy Setup: The Magic Behind the Scenes

When you create a Kubernetes Gateway resource, Kgateway automatically spins up, bootstraps, and manages gateway proxy deployments. This magic is achieved through a combination of Kgateway and Kubernetes resources, including GatewayClassGatewayParameters, and a gateway proxy template that includes the Envoy configuration for each proxy.

For a deeper dive into the default setup and how these resources interact, check out the Default gateway proxy setup.

Example of a GatewayClass:

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: kgateway
spec:
  controllerName: kgateway.dev/kgateway
  description: KGateway Controller
  parametersRef:
    group: gateway.kgateway.dev
    kind: GatewayParameters
    name: kgateway
    namespace: kgateway-system

Deployment Patterns: Choose how to route your traffic

Kgateway's flexibility allows you to deploy it in a way that best suits your environment. Here are some recommended deployment patterns:

Simple Ingress: The Classic Approach

Kgateway as a simple ingress

In this setup, a single Kgateway proxy serves as the ingress API gateway for all workloads in a Kubernetes cluster. It's centrally managed by the Kgateway control plane and configured to match and forward traffic based on your defined rules. This is a great starting point for smaller environments where all workloads run in a single cluster.

Sharded Gateway: Divide and Conquer

Kgateway as a sharded gateway

For larger environments or those with both high and low traffic services, a sharded gateway can help isolate services and protect against noisy neighbors. Multiple gateway proxies split the traffic for different services, providing better load balancing and isolation.

Sharded Gateway with Central Ingress: The Best of Both Worlds

Sharded gateway with central ingress

This pattern combines a central ingress gateway proxy with a second layer of sharded gateway proxies. The central gateway applies common traffic management, resiliency, and security rules, while the second layer handles traffic for specific apps, teams, or namespaces. This is ideal if you need a central IP address and DNS name for the gateway that serves all your traffic.

Kgateway can also be paired with other proxy types, such as HAProxy or AWS NLB/ALB, as your central ingress endpoint.

Central ingress with any proxy

API Gateway for a Service Mesh: Istio Ambient Mesh Integration

API gateway for Istio ambient mesh

Kgateway can be deployed as an ingress, egress, or waypoint proxy gateway for workloads in an Istio ambient mesh. This allows you to leverage Kgateway's features within your service mesh environment.

For more details, refer to the guides for using Kgateway as an ingress or waypoint proxy for your ambient mesh.

Kubernetes Gateway API Success with kgateway

Kgateway is a powerful and versatile tool for managing traffic in your Kubernetes environment. Whether you're running a small cluster or a large, complex infrastructure, Kgateway provides the features and flexibility you need to ensure secure, reliable, and efficient communication between your services. So, go ahead and give Kgateway a try – your microservices will thank you!

Learn more

kgateway
Kgateway is a feature-rich, fast, and flexible API gateway that is built on top of Envoy proxy and the Kubernetes Gateway API. It excels in function-level routing, supports legacy apps, microservices and serverless, offers robust discovery capabilities, integrates seamlessly with open-source projects, and is designed to support hybrid applications with various technologies, architectures, protocols, and clouds.
Welcome
Kgateway is a feature-rich, fast, and flexible API gateway that is built on top of Envoy proxy and the Kubernetes Gateway API. It excels in function-level routing, supports legacy apps, microservices and serverless, offers robust discovery capabilities, integrates seamlessly with open-source projects, and is designed to support hybrid applications with various technologies, architectures, protocols, and clouds.
Nicolás Georger

Nicolás Georger

Self-taught IT professional driving innovation & social impact with cybernetics, open source (Linux, Kubernetes), AI & ML. Building a thriving SRE/DevOps community at SREDevOps.org. I specialize in simplifying solutions through cloud native technologies and DevOps practices.