Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 53/ 160
03. Kubernetes Networking & Traffic Management

Kubernetes Gateway API (Next-Gen Replacement for Ingress: GatewayClass, Gateway, HTTPRoute)

Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources.

AdvancedGateway API · HTTPRoute · GatewayClass3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Gateway API is a data-center badge system: infrastructure owns doors, routing teams own floor directions, and a listener decides whose badge may enter. The simple Kubernetes rule is: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Think of it like…

Gateway API is a data-center badge system: infrastructure owns doors, routing teams own floor directions, and a listener decides whose badge may enter.

Where you’ve seen it

During a connectivity incident, the network owner runs kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout. Expected evidence: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants. If the run instead shows this symptom, stop and restore the last known state: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.

Words you’ll hear

Gateway API
For this lesson, Gateway API is the controlling idea: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
HTTPRoute
HTTPRoute is the checkpoint; run kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout and inspect the owner chain. Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.
GatewayClass
GatewayClass is the outcome to preserve; the cost is explicit: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.
Verification evidence
The evidence command is kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout. It connects the declaration to this behavior: Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Gateway API reaches the intended state

Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources. Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

The concrete checkpoint is kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout; compare the Gateway API owner, HTTPRoute state, and GatewayClass outcome instead of treating YAML acceptance as proof.

Verify HTTPRoute, not only object creation

Run kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout after the change and correlate the result with Events and the owning object. Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Key takeaway: Gateway API is implemented only when this invariant remains observable: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

HTTPRoute: failure boundary and production cost

Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute. The prerequisite contract is concrete: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary. A safe design limits blast radius, records the last good configuration, and uses kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout as a deterministic rollback checkpoint.

Recover from HTTPRoute drift

Capture the current state with kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.

Key takeaway: Accept the trade-off consciously: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

How it works, step by step

Step 1 of 4
Traffic author

1. Define the reachability contract

Declare selectors, listeners, routes, or policy and keep endpoint readiness explicit: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Gateway API contract → owned state
Key numbers at this step
Goal
Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources.
Owner
Gateway API

When to use it & trade-offs

What it is

Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources. Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Why it matters: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute. The invariant at risk is specific: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants. The quickest fact check before changing the design is kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout.

When to reach for it

  • Use Gateway API to enforce this invariant: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
  • Use HTTPRoute evidence from kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout in reviews and incident timelines. Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources.
  • Choose the managed ingress or mesh route only when this cost is justified by governance or scale: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

When to avoid or be careful

  • Avoid assuming Gateway API is complete after YAML submission; the required behavior is concrete: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout first: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

Native, manual, and managed paths for Gateway API

Built-in API path
Best for: Model north-south traffic with GatewayClass, Gateway, and HTTPRoute resources. A concrete incident check is kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout.

Strengths: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Watch out: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary. Recovery must also recognize this signal: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.

Datapath-specific extension
Best for: Quickly testing the HTTPRoute assumption with kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout; the expected invariant is: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Strengths: kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Gateway API, it does not make this symptom self-documenting: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.

Managed ingress or mesh
Best for: Teams that need GatewayClass integrated with guardrails; the evidence path is kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.

Watch out: The added platform ownership buys value at this cost: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
  • Trace Gateway API to GatewayClass through HTTPRoute; the invariant is: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
  • Recognize the symptom: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.
  • Justify the cost: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.
  • Verify with kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout instead of only inspecting YAML.

Benchmarks & rules of thumb

3 -
core API roles: GatewayClass, Gateway, and Route
1 -
listener can allow routes from one or multiple namespaces
2 -
conditions to inspect: Accepted and Programmed

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Gateway API owner contract: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants.
  • Ignoring this telltale condition leads to unrelated changes: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute.
  • Repeating kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout without an owner for remediation wastes retry cost. Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants?
  • Which owner object, logs, and Events would you inspect for this symptom-Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute-?
  • At what threshold would this cost become unacceptable: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary?
Interview tip: Interview sequence: state the invariant, run kubectl get gatewayclass,gateway,httproute -A; kubectl describe httproute checkout, name the failure, then justify the cost. Invariant: Gateway API separates infrastructure in GatewayClass and Gateway listeners from application routing in HTTPRoute, with policy attachment and cross-namespace grants. Failure: Accepted and Programmed conditions differ from route readiness, and a listener's hostname, protocol, certificate reference, or allowedRoutes can reject an otherwise valid HTTPRoute. Cost: Role-oriented Gateway resources reduce annotation sprawl and improve portability, but controller conformance and attached-policy versions still vary.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Kubernetes Gateway API (Next-Gen Replacement for Ingress: GatewayClass, Gateway, HTTPRoute) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Automating SSL/TLS Certificates with cert-manager & Let's Encrypt
Next topic
Traffic Splitting, Header Routing & Mirroring with Gateway API