Labels icon
Fail icon
Get icon
OutputValues icon
If icon
Commands icon
Docker icon
Log icon
Pause icon
Exit icon
Set icon
Assert icon
Delete icon
SlackIncomingWebhook icon
Schedule icon

Migrate ingress-nginx to Gateway API with a request-by-request check

Migrate ingress-nginx to Gateway API with ingress2gateway. Compare answers request by request, approve the result, then roll back or retire the Ingresses.

Categories
Infrastructure

ingress-nginx is retired and ingress2gateway translates most of its annotations. It prints the ones it cannot convert as warnings on stderr and still writes the routes. A dropped auth-url or a rewrite with capture groups then becomes a route that answers differently. This flow creates the routes next to the Ingresses. It sends the same requests to both controllers and shows every difference before anyone approves.

How it works

  1. plan reads the Ingresses of one class, translates them with a pinned and checksummed ingress2gateway, marks Ingresses with unconverted annotations as BLOCKED, validates the objects with a server side dry run. It refuses to touch objects this migration did not create. dry_run ends here.
  2. approve_plan (Pause) offers APPLY_CLEAN, APPLY_ALL or CANCEL, with the blocked Ingresses named.
  3. apply re-reads the Ingresses and stops if they changed, creates labeled Gateways, routes and policies. It waits until every Gateway is programmed and every route accepted. The KV key ingress-migration-<name> records the state.
  4. parity sends the same requests to ingress-nginx and to the Gateway: each path, a sub path, the canary header, an oversized POST for proxy-body-size, a CORS preflight and HTTPS for TLS hosts. It compares status and redirect target. For 2xx answers it also compares the body and the response headers.
  5. approve_result (Pause) offers ACCEPT, ACCEPT_WITH_EXCEPTIONS (a description is required), KEEP or ROLLBACK. Accepting re-reads the Ingresses first. It stores the answers as the baseline.
  6. RETIRE deletes the accepted Ingresses after you confirm that traffic moved. It keeps a backup and asks the Gateways again. It waits for ingress-nginx to stop answering. It restores the Ingresses when a Gateway answer changed. ROLLBACK deletes exactly the labeled objects.

What you get

  • The differences before any traffic moves. On the test cluster a rewrite with capture groups returned another body. An auth-url annotation turned a 401 into a 200. The HSTS header was missing.
  • Nothing is deleted before an approval. Every created object carries migration.kestra.io/name.
  • Execution labels outcome, blocked, probes and differences.

Who it's for

Platform teams that run ingress-nginx and must move to a Gateway API controller.

Why orchestrate this with Kestra

Pause with onResume inputs builds the decision form from the plan. The KV store makes every mode safe to run again. The restore step keeps a failed retire from leaving the old Ingresses deleted.

Tested end to end

26 runs on each of Kestra 2.0.6 and 2.0.5 with ingress-nginx 1.15.1, Envoy Gateway 1.9.3, Gateway API 1.6.3 and ingress2gateway 1.2.0 on Kubernetes 1.34. Covered: an Ingress changed during each approval, a missing GatewayClass, read only credentials, rollback and a retire that restored the Ingresses.

Prerequisites

A cluster with Gateway API CRDs and an accepted GatewayClass. Docker workers must reach the API server and both load balancers. Permissions: read Ingresses, Services and GatewayClasses. Manage Gateways and HTTPRoutes, plus Envoy policies with the envoy-gateway emitter. Delete Ingresses for RETIRE.

Secrets

K8S_KUBECONFIG holds the kubeconfig of the cluster. The tasks read it directly, so it is never shown in the execution form. SLACK_WEBHOOK_URL is used for the failure alert.

Inputs

gateway_class is required. emitter is envoy-gateway or standard. old_http_endpoint and old_https_endpoint are needed when the ingress-nginx Service has no load balancer address. dry_run defaults to true and auto_remediate to false.

Quick start

  1. Run MIGRATE with the defaults and read the plan.
  2. Run it again with dry_run false and auto_remediate true, choose APPLY_CLEAN and read the show_parity log.
  3. Accept, move DNS to the Gateway addresses, then run RETIRE.

How to extend

Only Envoy Gateway was tested. Probes come from one worker address. Weighted canaries, gRPC routes and TCP routes are not probed. Change the variables tool_url and tool_sha256 to pin or mirror another ingress2gateway release.

Links

This blueprint was created by zkasuran.

See How

New to Kestra?

Use blueprints to kickstart your first workflows.