Ingress and Ingress Controllers: HTTP Routing Without a Cloud Load Balancer
Kubernetes ingress explained: controller vs resource, host and path routing, TLS with cert-manager, annotations and the Gateway API.

A team exposes each of its twelve services with type: LoadBalancer. They end up with twelve cloud load balancers, twelve monthly charges, twelve IP addresses to put in DNS and twelve places to manage TLS certificates. What they actually wanted was one entry point that routes api.acme.example to one Service, app.acme.example to another and acme.example/docs to a third.
The Ingress resource describes exactly that: HTTP and HTTPS routing rules from hosts and paths to Services. An Ingress controller is a separate component, usually a reverse proxy running as pods in the cluster, that watches Ingress objects and turns them into proxy configuration. Kubernetes itself ships no controller; you install one. The Services it routes to are ordinary ClusterIP Services, as described in the Services article.
How traffic flows
Internet
|
Cloud load balancer (one)
|
Ingress controller pods (for example ingress-nginx)
| routing by Host header and path, TLS termination
+--> Service api --> api pods
+--> Service web --> web pods
+--> Service docs --> docs pods
The controller itself is usually exposed with a single LoadBalancer Service, so the whole cluster’s HTTP traffic shares one load balancer. Some cloud controllers, such as the AWS Load Balancer Controller, work differently: they configure the cloud’s application load balancer directly from Ingress objects instead of running a proxy in the cluster.
An Ingress with TLS
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: acme-web
namespace: web
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx
tls:
- hosts: ["acme.example", "api.acme.example"]
secretName: acme-web-tls
rules:
- host: api.acme.example
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: billing-api
port:
name: http
- host: acme.example
http:
paths:
- path: /docs
pathType: Prefix
backend:
service:
name: docs
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 80
ingressClassNameselects which controller handles this Ingress, since a cluster can run several. Mark one IngressClass as the default if you want Ingresses without a class to be picked up.pathTypeis required.Prefixmatches path segments, so/docsmatches/docsand/docs/installbut not/docsearch.Exactmatches one path only.ImplementationSpecificleaves it to the controller, which makes behavior less portable.- Longest match wins, so
/docstakes precedence over/regardless of order. tlsnames a Secret of typekubernetes.io/tlsholding the certificate. The controller terminates HTTPS and forwards plain HTTP to the Service unless you configure otherwise.
Certificates with cert-manager
cert-manager is the standard way to get and renew certificates in Kubernetes. With a ClusterIssuer for Let’s Encrypt, the annotation in the example above is all an application team needs: cert-manager sees the Ingress, requests a certificate for its hosts, completes the ACME challenge through the same controller, stores the result in the named Secret and renews it before it expires.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: platform@acme.example
privateKeySecretRef:
name: letsencrypt-prod-account
solvers:
- http01:
ingress:
ingressClassName: nginx
Use the Let’s Encrypt staging server while testing; production has rate limits that are easy to hit while debugging a misconfiguration.
Choosing a controller
| Controller | Strengths |
|---|---|
| ingress-nginx (Kubernetes project) | The most widely used; huge feature set through annotations; runs anywhere |
| Traefik | Simple configuration, automatic certificates, good fit for smaller clusters |
| HAProxy Ingress, Contour (Envoy), Kong | Performance, Envoy-based features, API gateway capabilities |
| AWS Load Balancer Controller, GKE Ingress | Native cloud load balancers, WAF and certificate integration, no in-cluster proxy |
Note that ingress-nginx, maintained by the Kubernetes project, and NGINX Ingress Controller, maintained by F5 NGINX, are different products with different annotations, which causes endless confusion when following tutorials.
Annotations: powerful and non-portable
The Ingress spec covers hosts, paths and TLS. Everything else, such as redirects, URL rewrites, request body size limits, timeouts, rate limits, authentication and CORS, comes from controller-specific annotations:
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "20m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "120"
nginx.ingress.kubernetes.io/limit-rps: "20"
Annotations tie your manifests to one controller. Be especially careful with annotations that inject raw proxy configuration, such as ingress-nginx’s snippet annotations. They led to serious vulnerabilities in 2023 that let users with permission to create Ingresses read Secrets across the cluster, and recent ingress-nginx releases disable them by default. Keep them disabled unless every Ingress author is fully trusted.
Bare metal and local clusters
Without a cloud provider, nothing fulfills LoadBalancer Services. Options include MetalLB, which assigns addresses from a pool on your network and announces them via ARP or BGP; exposing the controller with a NodePort Service behind an external load balancer you already run; or running the controller with host networking on dedicated edge nodes. Local tools such as kind and minikube document their own ingress setups.
The Gateway API
The Ingress API is stable but deliberately frozen: new features go into the Gateway API, which reached v1.0 in October 2023. It splits responsibilities across resources: a GatewayClass (the controller type, owned by the platform provider), a Gateway (listeners, ports and certificates, owned by the cluster operator) and HTTPRoute objects (routing rules, owned by application teams). It supports header-based matching, weighted traffic splitting for canaries and cross-namespace routing natively, instead of through annotations. Most major controllers already implement it. For a new platform, it is worth evaluating; for existing Ingress setups, there is no rush to migrate.
Frequently Asked Questions
What is the difference between an Ingress and an Ingress controller?
An Ingress is a Kubernetes resource that declares HTTP routing rules by host and path. An Ingress controller is software running in or alongside the cluster that reads those rules and configures a proxy or load balancer to apply them. Without a controller, Ingress objects have no effect.
Should I use Ingress or a LoadBalancer Service?
Use Ingress for HTTP and HTTPS services, so many applications share one load balancer with host and path routing and centralized TLS. Use LoadBalancer Services for non-HTTP protocols or when a service needs its own dedicated entry point.
How do I get free TLS certificates for Kubernetes Ingress?
Install cert-manager, create a ClusterIssuer for Let’s Encrypt and add the cert-manager.io/cluster-issuer annotation plus a tls section to your Ingress. cert-manager issues the certificate into the named Secret and renews it automatically.
Is the Gateway API replacing Ingress?
The Gateway API is the more capable successor, generally available since v1.0 in October 2023, and new routing features are added there rather than to Ingress. Ingress remains supported, so existing setups can migrate when they need the new capabilities.
One door, many rooms
An Ingress controller turns a cluster full of internal Services into a tidy set of public hostnames and paths behind one load balancer, with automatic certificates. Choose a controller deliberately, keep annotations to what you need, lock down raw configuration snippets, and keep an eye on the Gateway API as the long-term direction for traffic routing in Kubernetes. For the full reference, see the Ingress documentation and the Gateway API project. Related reading on this site: network policies.
Originally posted on 11 June 2024 and post last modified on 11 June 2024