Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

The Kubernetes Gateway API Explained

By Kokil Thapa | Last reviewed: September 2026

The Kubernetes Gateway API explained starts with a simple problem: classic Ingress was never enough for real platforms. One annotation soup, one controller dialect, and no clean split between platform teams and application teams. If you run microservices behind a load balancer today, you need a model that separates infrastructure from routing rules. That is what Gateway API delivers — a role-oriented, extensible successor to Ingress, now stable enough for production in 2026. This guide walks through the resources, a working HTTPRoute, how it compares to Ingress, and the mistakes I see on clusters that also host Laravel API workloads.

What is the Kubernetes Gateway API and why replace Ingress?

Ingress solved 2015-era HTTP routing. Platform teams pasted vendor-specific annotations onto one object. Application teams could not safely attach routes without touching shared infrastructure. Gateway API fixes that with three layers and clear ownership boundaries.

The model comes from the Kubernetes SIG Network community. It is not a single product — it is a set of CRDs that any conformant controller can implement. Popular implementations include Envoy Gateway, Istio, Cilium, Kong Gateway Operator, and Traefik. Your choice of controller determines which GatewayClass names you reference in manifests.

If you already understand the classic stack, read Kubernetes Ingress controllers explained first. Gateway API does not delete Ingress overnight. Many clusters run both during migration. The win is expressiveness: header-based routing, traffic splitting, cross-namespace references with ReferenceGrant, and TLS modes that Ingress never standardised.

Gateway API Resource LayersGatewayClass — cluster-scoped controller bindingPlatform team owns thisGateway — listeners, TLS, addressesInfra team provisions per envHTTPRoute — host, path, filtersApp team owns routing rulesService / Endpoints
The Kubernetes Gateway API explained as three ownership layers: GatewayClass, Gateway, and route objects pointing at Services.

Core resource families include:

  • GatewayClass — names the controller implementation, like istio or envoy.
  • Gateway — defines listeners (port, protocol, hostname, TLS).
  • HTTPRoute, GRPCRoute, TCPRoute, TLSRoute, UDPRoute — attach rules to Gateway listeners.
  • ReferenceGrant — allows cross-namespace backend or Gateway references.

That separation mirrors how real organisations work. Platform engineers install the controller once. Cluster operators create Gateways per environment. Product teams publish HTTPRoutes in their own namespaces. No shared Ingress object with forty annotation keys.

How do GatewayClass, Gateway, and HTTPRoute work together?

Think of traffic entering from the north-south edge. A cloud load balancer or MetalLB IP hits the Gateway listener. The controller matches host and path against HTTPRoute rules. Matching requests forward to Kubernetes Services and then Pods.

The binding is explicit. An HTTPRoute declares parentRefs pointing at a Gateway and listener section. The Gateway does not embed backend lists — routes attach from any allowed namespace.

GatewayClass — pick your controller once

GatewayClass is cluster-scoped. The controller vendor ships it, or you create one that matches their documentation. Example for a generic Envoy-based install:

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: envoy-gateway
spec:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller

Only controllers whose controllerName matches will reconcile Gateways using this class. Pin one class per environment so staging never accidentally points at a production controller profile.

Gateway — listeners and TLS termination

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: public-gateway
  namespace: infra
spec:
  gatewayClassName: envoy-gateway
  listeners:
    - name: https
      protocol: HTTPS
      port: 443
      hostname: api.example.com
      tls:
        mode: Terminate
        certificateRefs:
          - name: api-tls
            kind: Secret
      allowedRoutes:
        namespaces:
          from: Selector
          selector:
            matchLabels:
              gateway-access: "true"

Listeners are typed. HTTPS listeners accept HTTPRoute attachments. TCP listeners accept TCPRoute. The allowedRoutes field is your guardrail — restrict which namespaces may attach routes.

HTTPRoute — application-level routing

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: orders-api
  namespace: commerce
spec:
  parentRefs:
    - name: public-gateway
      namespace: infra
      sectionName: https
  hostnames:
    - api.example.com
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /v1/orders
      backendRefs:
        - name: orders-svc
          port: 8080
      filters:
        - type: RequestHeaderModifier
          requestHeaderModifier:
            add:
              - name: X-Forwarded-Proto
                value: https

Filters replace many Ingress annotations: redirects, header rewrites, URL rewrites, and request mirrors. For gRPC backends, swap HTTPRoute for GRPCRoute with the same parentRef pattern.

Gateway API Request FlowClientLoad BalancerGatewayHTTPRouteServicePodsController reconciles:1. Gateway status address2. Route attachment3. Envoy / proxy config4. Health and readiness
North-south traffic through Gateway API: external load balancer, Gateway listener, HTTPRoute match, Service, and Pod endpoints.

Status fields matter in operations. Run kubectl get gateway,httproute -A and inspect .status.parents on routes. A route showing Accepted=False usually means a hostname mismatch, a missing ReferenceGrant, or a listener that disallows the route namespace. That beats debugging a silent 404 from a mis-annotated Ingress.

How do you install and configure the Kubernetes Gateway API?

Installation has two parts: the CRDs (the API surface) and a controller (the data plane). Most teams install CRDs from the official release bundle, then deploy a controller Helm chart.

Step 1 — Install Gateway API CRDs

  1. Pick a release channel. Standard channel CRDs are appropriate for most clusters in 2026.
  2. Apply the manifest bundle published by SIG Network.
  3. Verify CRDs exist with kubectl get crd | grep gateway.networking.k8s.io.
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v1.2.0" | kubectl apply -f -

Check your controller docs for the minimum Gateway API version they support. Mismatch between CRD version and controller version is a common first-day failure.

Step 2 — Deploy a conformant controller

Envoy Gateway is a popular open-source choice with a dedicated data plane. Istio and Cilium fit if you already run those stacks. For teams comparing edge proxies, see Kong API Gateway guide and Traefik as an API Gateway — both have Gateway API conformance paths alongside classic Ingress modes.

After Helm install, confirm the controller created a GatewayClass:

kubectl get gatewayclass
kubectl describe gatewayclass envoy-gateway

Step 3 — Wire external access

Gateway status should expose an address. On cloud clusters that is often a managed LB hostname. On bare metal you may pair Gateway API with MetalLB or kube-vip — see Kubernetes on bare metal with MetalLB.

Step 4 — Enable cross-namespace routes with ReferenceGrant

When an HTTPRoute in namespace commerce references a Service in namespace payments, the payments namespace needs a ReferenceGrant:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata:
  name: allow-commerce-routes
  namespace: payments
spec:
  from:
    - group: gateway.networking.k8s.io
      kind: HTTPRoute
      namespace: commerce
  to:
    - group: ""
      kind: Service

Skip ReferenceGrant and the route stays rejected — by design. This is safer than Ingress backends that silently crossed namespaces through ambiguous annotation conventions.

Validate YAML structure with a JSON formatter when converting OpenAPI examples or controller output during debugging.

How does Gateway API compare to Ingress and service meshes?

Gateway API is not a service mesh replacement. It focuses on north-south entry. East-west traffic still belongs to mesh sidecars, Cilium network policies, or plain ClusterIP Services. Read Kubernetes networking model explained for the full picture and network policies for pod-level firewalls.

CriteriaIngress (networking.k8s.io/v1)Gateway API (v1)
Role separationSingle object mixes infra + routesGatewayClass / Gateway / Route split
PortabilityHeavy reliance on vendor annotationsStandard filters, typed routes
ProtocolsHTTP/S primarilyHTTP, gRPC, TCP, TLS, UDP route types
Cross-namespaceInformal, annotation-dependentReferenceGrant with explicit policy
Traffic splittingNon-standard canary annotationsWeighted backendRefs in HTTPRoute
Maturity (2026)Universal, stable, limitedGA core types; wide controller support

When should you stay on Ingress? Small clusters, one team, one controller, and no cross-namespace complexity — Ingress still works. When should you adopt Gateway API? Multiple teams, canary releases, gRPC, or you are standardising edge config across environments managed by GitOps tools like Argo CD GitOps for Kubernetes.

Compared to standalone API gateways at the edge, Gateway API keeps routing declarative inside the cluster. For a broader comparison of edge products, see API gateways for microservices and Kong vs Traefik vs AWS API Gateway.

Ingress vs Gateway APIClassic IngressOne Ingress objectAnnotations per vendorShared edit surfaceLimited protocol typesGateway APIGatewayClass + GatewayHTTPRoute per appVerdict: Ingress for simplesingle-team clustersGateway API for platformsVerdict: Gateway API winsmulti-team, gRPC, canariesReferenceGrant security
Ingress bundles everything into one object; Gateway API splits platform and application concerns for safer multi-team clusters.

What production patterns and mistakes should you watch for?

On clusters that host booking systems and APIs — like the Laravel + Livewire stack on Adventure Third Pole Trek — edge routing errors show up as intermittent 502s, not application exceptions. Gateway API makes status visible, but you still need discipline.

Canary and weighted backends

HTTPRoute supports weighted backendRefs for gradual rollouts:

backendRefs:
  - name: orders-v2
    port: 8080
    weight: 10
  - name: orders-v1
    port: 8080
    weight: 90

Pair this with horizontal pod autoscaling on both Deployments. Weights shift traffic before you scale down the old version.

TLS and certificate rotation

Prefer cert-manager Certificate resources referenced from Gateway TLS blocks. Rotate secrets before expiry; controllers hot-reload most data planes. Terminate TLS at the Gateway for north-south traffic unless compliance demands end-to-end encryption to Pods.

Observability hooks

Export controller metrics and access logs from the data plane — Envoy, Traefik, or Cilium each expose Prometheus endpoints. Correlate 5xx spikes with route attachment changes. When debugging Pod crashes behind bad routes, start with debugging CrashLoopBackOff and trace backward to Service port mismatches.

GitOps and tenancy

Store Gateway objects in an infra repo and HTTPRoutes in application repos. Argo CD ApplicationSets can template routes per team namespace. Restrict who may create GatewayClass objects — that is cluster-admin territory.

For Laravel services moving into Kubernetes, combine this edge layer with Kubernetes for Laravel getting started and solid API development practices. The Gateway does not replace application auth — use Sanctum or OAuth at the app layer and treat the Gateway as transport routing.

Gateway API Production GotchasPin GatewayClassOne class per environmentAvoid shared GatewaysSplit by env or tenantAdd ReferenceGrantBefore cross-ns backendsCheck route statusAccepted must be TrueMatch CRD version to controllerUpgrade both together in change windows
Common Gateway API production gotchas: environment-scoped GatewayClass, ReferenceGrant for cross-namespace Services, and route status checks.

Official references worth bookmarking: the Gateway API SIG documentation for CRD specs and conformance profiles, and the Kubernetes Gateway concept page for core behaviour. The implementation compatibility table lists which controllers support GRPCRoute, TLSRoute, and extended filters before you commit to one vendor.

If you manage the full stack — cluster, CI, and app deploys — Linux system administration and support and maintenance cover the operational side when Gateway upgrades land in your change window. For end-to-end request tracing from kube-apiserver to Pod, read a Kubernetes API request end-to-end flow.

Key Takeaways

  • Gateway API splits edge config into GatewayClass, Gateway, and route objects with clear team ownership.
  • HTTPRoute parentRefs bind routes to listeners; always inspect .status.parents when routes fail.
  • Install matching CRD and controller versions, then expose Gateway addresses via cloud LB or MetalLB.
  • Use ReferenceGrant for cross-namespace Service backends — rejected routes are safer than silent misroutes.
  • Gateway API handles north-south entry; pair it with network policies or a mesh for east-west security.
  • Migrate incrementally: run Gateway API beside Ingress until every hostname moves to HTTPRoute.

People Also Ask

Is Gateway API stable for production in 2026?

Yes for core types — GatewayClass, Gateway, and HTTPRoute reached GA in the v1 API group. Controllers differ in advanced feature support, so check the conformance table for your vendor before relying on GRPCRoute or TCPRoute in production.

Do I need to remove Ingress to use Gateway API?

No. Both can coexist on the same cluster during migration. Point new hostnames at Gateway listeners and retire Ingress objects one service at a time. Controllers often ship dual-mode reconciliation for transitional clusters.

Which controller should I choose?

Pick the controller you already operate. Istio if you run a mesh, Cilium if you use it for networking policies, Envoy Gateway for a dedicated lightweight data plane, or Kong/Traefik if those already front your APIs. Conformance level matters more than brand name.

How is Gateway API different from a service mesh?

Gateway API routes external traffic into the cluster. A service mesh manages east-west traffic between Pods with mTLS and fine-grained policy. They complement each other — many Istio deployments use Gateway API for ingress and mesh rules internally.

Deploy Gateway API with confidence

The Kubernetes Gateway API explained above is the model modern platforms standardise on: typed routes, explicit permissions, and controller portability without annotation dialects. Start with one Gateway, one HTTPRoute, and a smoke-test Service — then expand to weighted canaries and cross-namespace ReferenceGrants as your teams grow. Need help designing edge routing for a Laravel API or multi-tenant platform? Contact us or explore custom software development and recent portfolio work on production web systems.

Frequently Asked Questions

GatewayClass picks the controller, Gateway exposes listeners, and HTTPRoute maps host and path rules to Services — a typed, role-split replacement for annotation-heavy Ingress.

Ingress solved 2015-era HTTP routing with one object mixing infrastructure and routes. Platform teams piled vendor-specific annotations onto shared Ingress resources, and application teams could not attach routes safely without touching cluster-wide config. Gateway API separates concerns into GatewayClass, Gateway, and route objects with explicit ownership boundaries. It adds header-based routing, standard traffic splitting, typed protocols beyond HTTP/S, cross-namespace references controlled by ReferenceGrant, and TLS modes Ingress never standardised — without forcing every team to learn one controller's annotation dialect.

Traffic enters from a cloud load balancer or MetalLB IP and hits a Gateway listener on port 443 or 80. The conformant controller matches host and path against HTTPRoute rules whose parentRefs point at that Gateway listener. Matching requests forward to Kubernetes Services and then Pods. GatewayClass is cluster-scoped and pins which controller reconciles the Gateway. The Gateway defines listeners, TLS, and which namespaces may attach routes. HTTPRoutes live in application namespaces and declare backends via backendRefs — the Gateway never embeds backend lists.

Installation has two parts: Gateway API CRDs and a conformant controller. Apply the Standard channel CRD bundle from SIG Network and verify CRDs exist with kubectl get crd filtered for gateway.networking.k8s.io. Match CRD version to your controller's documented minimum — mismatch between CRD and controller versions is a common first-day failure. Deploy a controller via Helm — Envoy Gateway, Istio, Cilium, Kong Gateway Operator, or Traefik — then confirm it created a GatewayClass. Expose external access by wiring the Gateway address to a cloud load balancer or MetalLB on bare metal. Add ReferenceGrant resources before cross-namespace route attachments.

Ingress bundles infrastructure and routing into one object with heavy vendor annotation reliance. Gateway API splits GatewayClass, Gateway, and route objects for role separation and portability. Ingress focuses on HTTP/S; Gateway API adds gRPC, TCP, TLS, and UDP route types. Cross-namespace backends on Ingress were informal and annotation-dependent; Gateway API requires explicit ReferenceGrant policy. Canary traffic on Ingress used non-standard annotations; HTTPRoute supports weighted backendRefs natively. In 2026 both are mature — Ingress is universal but limited; Gateway API GA core types have wide controller support and suit multi-team platforms standardising edge config with GitOps tools like Argo CD.

Gateway API handles north-south traffic — external requests entering the cluster through edge listeners. A service mesh manages east-west traffic between Pods with sidecars, mTLS, and fine-grained internal policy. They are complementary, not replacements. Cilium network policies or plain ClusterIP Services still cover pod-level east-west security if you skip a mesh. Many Istio deployments already use Gateway API for ingress while mesh rules govern internal calls. Deploy Gateway API for the load-balancer edge; keep mesh or network policies for intra-cluster communication.

ReferenceGrant is a Gateway API resource that explicitly allows cross-namespace references. When an HTTPRoute in namespace commerce points backendRefs at a Service in namespace payments, the payments namespace must contain a ReferenceGrant permitting HTTPRoutes from commerce to reference Services there. Without it the route stays rejected with Accepted=False — by design. This is safer than Ingress patterns where ambiguous annotations could silently route across namespaces. Apply ReferenceGrant in the namespace that owns the referenced resource, not the route namespace. Treat it as mandatory policy any time teams share Gateways but own backends in separate namespaces.

Pick the controller you already operate rather than chasing brand names. Use Istio if you run that mesh, Cilium if it already handles cluster networking, Envoy Gateway for a dedicated lightweight Envoy data plane, or Kong Gateway Operator or Traefik if those already front your APIs. Each ships a GatewayClass whose controllerName must match what you reference in manifests. Check the official implementation compatibility table before committing — GRPCRoute, TLSRoute, and extended filters vary by vendor conformance level. Conformance matters more than marketing; pin one GatewayClass per environment so staging never accidentally points at a production controller profile.

Yes — GatewayClass, Gateway, and HTTPRoute reached GA in the v1 API group. Verify your controller's conformance table before relying on GRPCRoute, TCPRoute, or advanced filters in production.

No. Both can run on the same cluster during migration. Point new hostnames at Gateway listeners and retire Ingress objects one service at a time.

Run kubectl get gateway,httproute across namespaces and inspect status.parents on each route. Accepted=False usually signals hostname mismatch with the Gateway listener, a missing ReferenceGrant for cross-namespace backends, or allowedRoutes on the Gateway blocking the route namespace. That visible rejection beats debugging silent 404s from mis-annotated Ingress. Also confirm Gateway status exposes an external address and that Service port numbers in backendRefs match Pod containers. On clusters hosting Laravel API workloads, edge misconfiguration often surfaces as intermittent 502s rather than application exceptions — trace backward from data plane access logs and Service port mismatches.

Define TLS on Gateway listeners with mode Terminate and certificateRefs pointing at Kubernetes Secrets — often populated by cert-manager Certificate resources. Terminate TLS at the Gateway for north-south traffic unless compliance requires encryption all the way to Pods. Rotate secrets before expiry; most conformant controllers hot-reload certificates into the data plane without dropping listeners. HTTPS listeners accept HTTPRoute attachments; hostnames on Gateway listeners and HTTPRoute hostnames fields must align. Mismatched hostnames are a frequent cause of routes showing Accepted=False in status.

HTTPRoute supports weighted backendRefs for gradual rollouts without vendor-specific Ingress annotations. Point two backendRefs at v1 and v2 Services with weights such as 90 and 10, then shift ratios as confidence grows. Pair weight changes with horizontal pod autoscaling on both Deployments so traffic moves before you scale down the old version. Export controller metrics and access logs from the data plane — Envoy, Traefik, and Cilium each expose Prometheus endpoints — and correlate 5xx spikes with route attachment changes. Store route weight patches in GitOps repos while Gateway objects stay in an infra repo.

Stay on Ingress for small clusters with one team, one controller, and no cross-namespace routing, gRPC, or canary complexity — it still works fine in 2026.

HTTPRoute filters provide standard cross-controller behaviour that Ingress left to annotation dialects. RequestHeaderModifier adds or changes headers — useful for setting X-Forwarded-Proto to https behind TLS-terminating Gateways. Filters also cover redirects, header rewrites, URL rewrites, and request mirrors. For gRPC backends, use GRPCRoute with the same parentRef pattern instead of HTTPRoute. This typed filter model improves portability: application teams express edge behaviour in CRD fields controllers must reconcile, not in keys only one Ingress implementation understands. The Gateway handles transport routing — application auth still belongs at the app layer with Sanctum or OAuth.

Share this article

0 Comments

Leave a comment

Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

Quick Contact Options
Choose how you want to connect me: