Migrating from Ingress to Gateway API without downtime

#kubernetes #gateway-api #ingress-nginx #migration #sre

ingress-nginx was retired in March 2026. Last release was v1.15.1, the repo is archived, and there won't be another security fix. It still runs fine. That's exactly why it's easy to forget about. Do you have it?

kubectl get pods -A --selector app.kubernetes.io/name=ingress-nginx

You could swap in another Ingress controller. But if I'm going to touch every route anyway, I'd rather move to Gateway API once and be done with it.

Versions I checked on November 15, 2026: Kubernetes v1.37.2, Gateway API v1.7.0, ingress2gateway v1.2.0, cert-manager v1.21.3.

What actually changes

The cluster admin owns the GatewayClass. The platform team owns the Gateway, with listeners on ports 80 and 443 and the TLS certificates. App teams own HTTPRoutes that attach to it. With Ingress, one object holds routing, TLS and annotations, and everyone edits it.

The YAML isn't the big change. Ownership is. TLS and listeners move to the platform team, and app teams only own their routes.

ingressClassName becomes a GatewayClass, TLS becomes HTTPS listeners on the Gateway, hosts and paths become HTTPRoute hostnames and matches, backends become backendRefs with weights for canaries, rewrites and redirects become filters, timeouts become timeouts. Auth and rate limits need controller-specific policies, and snippets have no equivalent.

Hosts, paths and backends are easy. Annotations are where your week goes.

The setup

A blue-green switch at the edge: users resolve DNS with weighted records, 95 percent to blue, load balancer A and ingress-nginx, and 5 percent to green, load balancer B and the Gateway controller. Both reach the same Services. Rollback is one DNS weight change.

Don't cut over in place. Run both controllers, each with its own load balancer, in front of the same Services. DNS decides who gets what.

The steps

Prepare: inventory, install, convert, certificates. Test: curl --resolve, lower the TTL. Shift: move the weight 5, 25, 50, 100 percent, rolling back one step when SLOs aren't ok. Finish: soak a week at 0 percent, then decommission.

Prepare

# 1. which ingress-nginx annotations do we actually use?
kubectl get ingress -A -o json \
  | jq -r '.items[].metadata.annotations // {} | keys[]' \
  | grep '^nginx.ingress.kubernetes.io/' | sort | uniq -c | sort -rn

# 2. Gateway API CRDs (skip if your cloud manages them)
kubectl apply --server-side -f \
  https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.7.0/standard-install.yaml

# 3. first draft of the routes
ingress2gateway print --providers=ingress-nginx --all-namespaces > gateway-api.yaml

ingress2gateway gets you most of the way. Read every warning it prints. Then read Before You Migrate: ingress-nginx quietly does case-insensitive prefix regex, trailing-slash redirects and URL normalization, and a clean-looking conversion loses all of it.

A converted app ends up like this. The HTTPS redirect is its own route now:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: public
  namespace: gateway
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-dns01
spec:
  gatewayClassName: my-gateway-class
  listeners:
    - name: http
      port: 80
      protocol: HTTP
      allowedRoutes: { namespaces: { from: All } }
    - name: https-shop
      hostname: shop.example.com
      port: 443
      protocol: HTTPS
      tls:
        certificateRefs: [{ name: shop-example-com-tls }]
      allowedRoutes: { namespaces: { from: All } }
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: { name: shop-redirect, namespace: shop }
spec:
  parentRefs: [{ name: public, namespace: gateway, sectionName: http }]
  hostnames: [shop.example.com]
  rules:
    - filters:
        - type: RequestRedirect
          requestRedirect: { scheme: https, statusCode: 301 }
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: { name: shop, namespace: shop }
spec:
  parentRefs: [{ name: public, namespace: gateway, sectionName: https-shop }]
  hostnames: [shop.example.com]
  rules:
    - matches: [{ path: { type: PathPrefix, value: /api } }]
      backendRefs: [{ name: shop-api, port: 8080 }]
      timeouts: { request: 60s }
    - matches: [{ path: { type: PathPrefix, value: / } }]
      backendRefs: [{ name: shop-web, port: 80 }]

Certificates

HTTP-01 fails during the migration because Let's Encrypt follows DNS to the old load balancer while the solver runs on the new one. DNS-01 checks a TXT record at the DNS provider, so it works while both paths run. Or reuse the existing Secret with a ReferenceGrant.

Test

Users follow DNS to the old load balancer. You test with curl --resolve, which sends the real hostname straight to the new load balancer. Both reach the same Services, and nobody else notices.

Then replay real paths from the access log against both IPs and chase every difference:

H=shop.example.com
OLD=203.0.113.10   # the ingress-nginx load balancer
NEW=$(kubectl get gateway -n gateway public -o jsonpath='{.status.addresses[0].value}')

# paths.txt: real paths from the ingress-nginx access log
while read -r p; do
  a=$(curl -s -o /dev/null -w '%{http_code}' --resolve $H:443:$OLD "https://$H$p")
  b=$(curl -s -o /dev/null -w '%{http_code}' --resolve $H:443:$NEW "https://$H$p")
  [ "$a" = "$b" ] || echo "DIFF $p old=$a new=$b"
done < paths.txt

Shift

Chart of traffic share over time. The new path steps up to 5, 25 and 50 percent with an SLO check after each hold, drops back to 25 percent when p99 rises, then goes to 50 and 100. The old path mirrors it, leaves a small tail of stragglers during the soak, and is then decommissioned.

Drop the TTL to 60s a day before. Hold each step through a peak and compare 5xx and p99 on both paths side by side. If ExternalDNS owns the records, take it out of the loop until you're done, otherwise its Ingress and HTTPRoute sources fight over the same name.

Finish

Leave the old path up for a week. JVM DNS caches, long-lived connections and hard-coded IPs don't care about your TTL. Turn it off when its access log goes quiet. One trap: deleting an annotated Ingress also deletes its cert-manager Certificate.

Gotchas

Sources

$ share: [ ] [ X ] [ LinkedIn ]