Skip to main content

Ingress

Ingress is a Kubernetes API object that routes external HTTP and HTTPS traffic to Services inside a cluster based on hostnames and paths. It lets many services share one load balancer instead of each needing its own, but it only works when an Ingress controller is installed.

The problem it solves

Giving every Service its own LoadBalancer means one cloud load balancer, one IP, and one bill per service. Ingress puts a single entry point in front of many services and routes by rules.

flowchart TD I["Internet"] --> L["Cloud load balancer"] L --> C["Ingress controller"] C -->|"/payments"| P["payment-service"] C -->|"/accounts"| A["account-service"] classDef ext fill:#475569,color:#ffffff classDef ctl fill:#326CE5,color:#ffffff classDef svc fill:#D1FAE5,color:#1E293B class I,L ext class C ctl class P,A svc

Resource vs controller

  • The Ingress resource is the YAML that defines routing rules.
  • The Ingress controller is the software that reads those rules and serves traffic, for example NGINX, Traefik, HAProxy, or a cloud-native controller such as the AWS Load Balancer Controller.

Kubernetes does not ship a controller. An Ingress object without one does nothing.

Remember

Check the project status of your controller before adopting it. The community ingress-nginx project was announced for retirement in 2026, so for new clusters evaluate alternatives and the Gateway API, which is the more expressive successor to Ingress.

Example

YAML
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: payments-routing
namespace: production
spec:
ingressClassName: nginx
tls:
- hosts:
- api.example.com
secretName: api-example-tls
rules:
- host: api.example.com
http:
paths:
- path: /payments
pathType: Prefix
backend:
service:
name: payment-service
port:
number: 80
- path: /accounts
pathType: Prefix
backend:
service:
name: account-service
port:
number: 80

Path types

Type Behaviour
Prefix Matches the path and everything beneath it
Exact Matches only that exact path
ImplementationSpecific Controller-defined, avoid unless needed

Troubleshooting

Bash
kubectl get ingress -A
kubectl describe ingress payments-routing -n production
kubectl get secret api-example-tls -n production
Security

Never expose admin UIs such as Grafana, Argo CD, or the Kubernetes dashboard through Ingress without authentication. Terminate TLS and force HTTPS redirects.

Common Mistake

Using Exact when you meant Prefix. Sub-paths such as /payments/upi then return 404.

Frequently Asked Questions

What does Ingress do that a LoadBalancer Service does not?

It shares one external load balancer across many services and routes by hostname and path. A LoadBalancer Service exposes a single service and provisions its own load balancer.

Why did my Ingress change nothing?

No Ingress controller is running, or ingressClassName does not match the installed controller. The resource is only configuration until a controller acts on it.

Ingress or Gateway API?

Ingress is simple and widely supported. Gateway API offers richer, role-oriented routing such as header matching and traffic weighting and is the direction of the ecosystem for new designs.

Found a mistake, an outdated step or a broken link?