Ingress vs Gateway API: Why Kubernetes Networking is Changing
What is Kubernetes Gateway API?
The Gateway API is a set of CRDs (Custom Resource Definitions) that define how traffic enters your cluster.
Managed by: Kubernetes SIG Network
Designed as a replacement for: Ingress

Key Components
1. GatewayClass
- Defines the type of gateway implementation
- Managed by platform teams
Example:
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: nginx
spec:
controllerName: k8s.io/nginx-gateway-controller
2. Gateway
- Represents the actual load balancer
- Defines listeners (HTTP, HTTPS, TCP)
Example:
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: nginx
listeners:
- name: http
protocol: HTTP
port: 80
3. HTTPRoute
- Defines routing rules
- Similar to Ingress rules but more powerful
Example:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: my-route
spec:
parentRefs:
- name: my-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /app
backendRefs:
- name: my-service
port: 80
🧠 Why Gateway API (vs Ingress)?
| Feature | Ingress | Gateway API |
|---|---|---|
| Flexibility | Limited | High |
| Role separation | NO | (Dev vs Platform team) |
| Traffic splitting | Basic | Advanced |
| Protocol support | Mostly HTTP | HTTP, TCP, gRPC |
| Extensibility | Low | High |
Flow:
- User → Load Balancer (Gateway)
- Gateway → Listener (port/protocol)
- Listener → HTTPRoute
- HTTPRoute → Kubernetes Service
- Service → Pods
How to Implement Gateway API (Step-by-Step)
Step 1: Install Gateway API CRDs
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/latest/download/standard-install.yaml
Step 2: Install Gateway Controller
You need a controller like:
- NGINX Gateway Controller
- Istio
- Traefik
👉 Example (NGINX):
helm install nginx-gateway oci://ghcr.io/nginxinc/charts/nginx-gateway-fabric
Step 3: Create GatewayClass
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: nginx
spec:
controllerName: k8s.io/nginx-gateway-controller
Step 4: Create Gateway
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: app-gateway
spec:
gatewayClassName: nginx
listeners:
- name: http
protocol: HTTP
port: 80
Step 5: Deploy Application
apiVersion: v1
kind: Service
metadata:
name: app-service
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 8080
Step 6: Create HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: app-route
spec:
parentRefs:
- name: app-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: app-service
port: 80
Step 7: Verify
kubectl get gateway
kubectl get httproute
kubectl describe gateway app-gateway
Real-Time Use Cases (Important for Interviews)
1. Microservices Routing
/user→ user-service/order→ order-service
2. Canary Deployment
- 90% → v1
- 10% → v2
3. Multi-Tenant Clusters
- Platform team manages Gateway
- Dev team manages Routes
4. API Gateway Replacement
- Works like AWS API Gateway inside cluster
Pro Tips (Architect Level)
- Use Gateway API + EKS + AWS Load Balancer Controller
- Combine with Service Mesh (Istio) for advanced routing
- Use TLS termination at Gateway
- Integrate with WAF + security policies
When to Use Gateway API?
Use Gateway API when:
- You need advanced routing (canary, A/B testing)
- You want separation of concerns
- You are building enterprise-grade Kubernetes platform
Avoid when:
- Simple apps → Use Ingress
