Ingress and ingress controllers

Intermediate · 9 min

HTTP routing by host and path: the Ingress API, IngressClass, path matching and TLS, why controllers differ, and what ingress-nginx's retirement means.

Before thisServices: ClusterIP, NodePort and LoadBalancerCluster DNS and service discovery

Anton Putra · 9 min

Ingress and ingress controllers

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Anton PutraReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • An Ingress routes HTTP and HTTPS by host and path to Services, so many apps share one load balancer and one IP. It's only rules: an ingress controller (a proxy running in the cluster) does the work.
  • IngressClass ties an Ingress to a controller. One class can be marked default, and the API server fills it into Ingresses that don't name one.
  • pathType Prefix matches whole path segments (/api matches /api/v1, not /apiary), Exact matches one path, and ImplementationSpecific is up to the controller. The longest matching path wins.
  • The Ingress API is frozen and small, so real features live in controller-specific annotations. Ingresses aren't portable between controllers, and annotations like snippets became security holes.
  • ingress-nginx, once the default choice, was retired in March 2026 and gets no more fixes. New work should use the Gateway API or another maintained controller.

One load balancer per Service gets expensive

A LoadBalancer Service gives one app one external IP and one cloud load balancer. Do that for a storefront, an API, an admin UI and a docs site and you’re paying for four load balancers, managing four sets of DNS records and four TLS certificates, and none of them understands HTTP. They forward TCP.

Most web traffic wants the opposite: one entry point that reads the Host header and URL path and sends shop.example.com/api to one Service and shop.example.com/ to another. That’s a reverse proxy, the job nginx, HAProxy and Envoy have always done. Ingress is Kubernetes’s API for describing those rules, so the proxy can be configured from cluster objects instead of hand-edited files.

Rules and the thing that obeys them

An Ingress is a set of rules:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata: {name: shop, namespace: shop}
spec:
  ingressClassName: traefik
  tls:
  - hosts: [shop.example.com]
    secretName: shop-tls
  rules:
  - host: shop.example.com
    http:
      paths:
      - {path: /api, pathType: Prefix, backend: {service: {name: api, port: {number: 80}}}}
      - {path: /, pathType: Prefix, backend: {service: {name: web, port: {name: http}}}}

On its own it does nothing. The API server stores it, and that’s all Kubernetes itself does with it. An ingress controller (a proxy Deployment plus a control loop) watches Ingresses, Services, EndpointSlices and TLS Secrets and turns them into proxy configuration. Usually the controller itself sits behind a single LoadBalancer Service, and that one IP serves every hostname. Think of an Ingress as a seating chart and the controller as the maître d’ who reads it. A chart with no maître d’ seats nobody, which is exactly what we saw in the lab: the Ingress applied fine and its ADDRESS column stayed empty, because no controller runs there to fill in status.loadBalancer.

Many controllers exist: Traefik, HAProxy, Contour, Kong, F5’s NGINX Ingress Controller, Envoy-based ones, and cloud controllers such as the AWS Load Balancer Controller, which provisions an ALB per Ingress (or group) rather than running a proxy in the cluster. Kubernetes ships none of them.

IngressClass

Several controllers can run in one cluster, say an internal and a public one. IngressClass says which controller owns which Ingresses:

apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: traefik
  annotations: {ingressclass.kubernetes.io/is-default-class: "true"}
spec:
  controller: traefik.io/ingress-controller

The default-class annotation is enforced by an admission plugin: an Ingress created without ingressClassName gets the default filled in. In the lab, kubectl create ingress noclass --rule="x.example.com/=web:80" came back with ingressClassName: traefik. The older kubernetes.io/ingress.class annotation is deprecated in favour of the field.

Matching hosts and paths

Hosts may be exact (shop.example.com) or a single leading wildcard (*.example.com, which matches one label only). *.*.example.com was refused by validation, and so was a path without a leading slash: must be an absolute path.

pathType is required:

  • Exact matches the path exactly, case-sensitive.
  • Prefix matches by /-separated element. /api matches /api and /api/orders, not /apiary.
  • ImplementationSpecific means whatever the controller decides, often regex in practice.

When several paths match, the longest wins, and Exact beats Prefix at equal length. A defaultBackend catches requests that match no rule.

TLS terminates at the controller. The tls section names a kubernetes.io/tls Secret with the certificate and key for those hosts. cert-manager is the usual way to get and renew those certificates from Let’s Encrypt or an internal CA: it watches Ingresses and writes the Secrets.

The annotation problem

The Ingress API went GA in 1.19 and has been feature-frozen since. It covers hosts, paths, TLS and backends. It has no field for rewrites, redirects, timeouts, header manipulation, rate limits, auth, canary weights, gRPC or TCP. Every controller filled the gap with its own annotations, such as nginx.ingress.kubernetes.io/rewrite-target or traefik.ingress.kubernetes.io/router.middlewares.

That has two costs. Ingresses aren’t portable: the spec is shared, but the behaviour most apps depend on lives in annotations that another controller ignores. And annotations became an attack surface. ingress-nginx let anyone who could write an Ingress inject raw NGINX config through “snippet” annotations, inside a proxy that could read Secrets across the cluster. In March 2025, the IngressNightmare vulnerabilities (CVE-2025-1974 among them) let anything that could reach its admission webhook run code in the controller. One API object, written by app teams, configuring shared infrastructure run by the platform team, with no clean way to split permissions between them: that’s the design the Gateway API replaces.

ingress-nginx is retired

For years, kubernetes/ingress-nginx was the default answer, so many tutorials still install it. In November 2025, SIG Network and the Security Response Committee announced its retirement: best-effort maintenance until March 2026, then no releases, bugfixes or security patches. The repository was archived in March 2026. Existing installs keep running, which is the danger: they will never get another CVE fix. (F5’s separately maintained “NGINX Ingress Controller” is a different project and isn’t retired.)

The project’s advice is to move to the Gateway API, or to another maintained Ingress controller if you must keep Ingress. The ingress2gateway tool converts Ingresses, and some ingress-nginx annotations, to Gateway API resources. Check what it can’t convert before you trust it.

About the video

The embed is Anton Putra’s “Kubernetes Ingress Explained (2 Types)”, August 2023, 9 minutes. Its chapters cover load balancers versus Ingress, how Ingress works, cert-manager for TLS, the primitives involved, and private (internal) ingress, with a practice section. It predates the ingress-nginx retirement, so ignore any suggestion to start new work with ingress-nginx. Kubesimplify’s video in deeper covers the retirement and a migration to the Gateway API with ingress2gateway. Both were judged from chapters and descriptions, since transcripts can’t be fetched here, and from their “English (US) original” audio tracks.

What was run: against a local v1.37.3 API server with no ingress controller, we created the IngressClass and Ingress above with a TLS Secret, saw the default class filled in by admission, saw the wildcard-host and relative-path validation errors, and saw the ADDRESS stay empty. No traffic was routed. Matching rules are from the Ingress docs, and the retirement facts from the Kubernetes blog posts of March and November 2025 and the archived GitHub repository, checked 2026-11-28.

Where this fits

Ingress’s limits are exactly what its successor was designed around. Next: the Gateway API.

Check yourself

  1. 01You apply an Ingress and nothing happens: no ADDRESS, no routing. The YAML is valid. What's missing?

    A running ingress controller that watches that Ingress's class. The Ingress object is only configuration. Check kubectl get ingressclass, whether the Ingress names a class (or a default exists), and whether that controller's Pods are running.

  2. 02Paths /api (Prefix) and / (Prefix) are both defined for shop.example.com. Where does /api/orders go, and where does /apiary go?

    /api/orders goes to the /api backend: Prefix matches by path element and the longest match wins. /apiary goes to /, because apiary isn't the path element api.

  3. 03Your team migrates from ingress-nginx to Traefik and half the routes break, though the Ingress objects are unchanged. Why?

    Their behaviour was in nginx.ingress.kubernetes.io annotations (rewrites, auth, timeouts, CORS, snippets) that Traefik ignores. The core Ingress spec is portable, but the features most apps rely on are annotations, which are per controller.

  4. 04Why was the snippets annotation considered dangerous?

    It let anyone who could create an Ingress inject raw NGINX configuration into a proxy that held credentials able to read Secrets across the cluster. In multi-tenant clusters that turned Ingress write access into cluster-wide secret access.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark