Migrate from Ingress to Gateway API
This guide explains how to migrate existing Ingress resources to Gateway API. For a comparison, see Ingress and Gateway API.
The community NGINX Ingress Controller (kubernetes/ingress-nginx) retired in March 2026. Existing environments do not stop immediately, but security patches and bug fixes are no longer provided after retirement.
This guide uses NGINX Gateway Fabric. You can choose another implementation, such as Envoy, Istio, or Cilium; consult its official documentation for deployment and configuration.
Migration can cause service disruption or traffic loss. Validate it in a staging environment before applying it to production.
Prerequisites
Complete the following prerequisites before migration.
Checks before migration
- Custom Ingress annotations do not map one-to-one to Gateway API. Review annotations such as
rewrite-target,proxy-body-size, andssl-redirectagainst the selected controller documentation. - On Kubernetes 1.34 or later, Konnectivity enables API server communication with Admission Webhook servers, so
hostNetwork: trueis not required. On Kubernetes 1.32 and 1.33, configurehostNetwork: trueon Admission Webhook server pods if the controller includes them. - Gateway load balancers use private IPs by default. See load balancer options if a public IP is needed.
1. Back up existing Ingress configuration
kubectl --kubeconfig=$KUBECONFIG get ingress -A -o yaml > ingress-backup.yaml
2. Install Gateway API CRDs
See Gateway API deployment > Prerequisites.
kubectl --kubeconfig=$KUBECONFIG get crd | grep gateway
3. Deploy Gateway API controller
See Deploy the Gateway API controller.
kubectl --kubeconfig=$KUBECONFIG get pods -n nginx-gateway
4. Create Gateway resource
See Create a Gateway resource.
kubectl --kubeconfig=$KUBECONFIG get gateway -n nginx-gateway
NAME CLASS ADDRESS PROGRAMMED AGE
nginx-gateway nginx k8s-nginxga-nginxga-xxxxxxxxxx-xxxxxx.ke.kr-central-2.kakaocloud.com True 3m
Step 1. Convert Ingress resources
Choose automatic or manual conversion.
Automatic conversion
Use the ingress2gateway tool provided by Kubernetes SIG-Network to automatically convert existing Ingress resources into Gateway API resources (Gateway + HTTPRoute).
Install ingress2gateway
go install github.com/kubernetes-sigs/ingress2gateway@latest
Convert from cluster
Read Ingress resources deployed in current cluster and convert them into Gateway API resources.
ingress2gateway print --kubeconfig=$KUBECONFIG --providers=ingress-nginx --all-namespaces
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: nginx
namespace: demo-apps
spec:
gatewayClassName: nginx
listeners:
- name: http
port: 80
protocol: HTTP
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: path-routing-all-hosts
namespace: demo-apps
spec:
parentRefs:
- name: nginx
rules:
- backendRefs:
- name: app-v1
port: 80
matches:
- path:
type: PathPrefix
value: /api
- backendRefs:
- name: app-v2
port: 80
matches:
- path:
type: PathPrefix
value: /web
Convert from file
Convert Ingress YAML file directly without connecting to cluster.
ingress2gateway print --providers=ingress-nginx --input-file=ingress-backup.yaml
ingress2gateway print --providers=ingress-nginx --input-file=ingress-backup.yaml > gateway-api-resources.yaml
ingress2gateway converts core Ingress fields such as host, path, backend, and TLS, and also converts some commonly used annotations in ingress-nginx.
However, annotations and implementation-specific extensions are not always converted one-to-one. You must review gatewayClassName, namespace, hostnames, filters, and backendRefs.
Manual conversion and field mapping
For manual conversion, use the following before-and-after examples. These examples assume that the Gateway resource already exists.
Example 1. Route based on path
Before — Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: path-routing
namespace: demo-apps
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: app-v1
port:
number: 80
- path: /web
pathType: Prefix
backend:
service:
name: app-v2
port:
number: 80
After — HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: path-routing
namespace: demo-apps
spec:
parentRefs:
- name: nginx-gateway
namespace: nginx-gateway
rules:
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: app-v1
port: 80
- matches:
- path:
type: PathPrefix
value: /web
backendRefs:
- name: app-v2
port: 80
Key changes:
ingressClassName→parentRefsspec.rules[].http.paths→spec.rules[].matches[].pathbackend.service.name/port.number→backendRefs[].name/port
Example 2. Route based on host
Before — Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: host-routing
namespace: demo-apps
spec:
ingressClassName: nginx
rules:
- host: api.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-svc
port:
number: 80
- host: web.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web-svc
port:
number: 80
After — HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: api-route
namespace: demo-apps
spec:
parentRefs:
- name: nginx-gateway
namespace: nginx-gateway
hostnames:
- api.example.com
rules:
- backendRefs:
- name: api-svc
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: web-route
namespace: demo-apps
spec:
parentRefs:
- name: nginx-gateway
namespace: nginx-gateway
hostnames:
- web.example.com
rules:
- backendRefs:
- name: web-svc
port: 80
Key changes:
spec.rules[].host→ HTTPRoutespec.hostnames- Create separate HTTPRoute per host for independent management (multiple hostnames can also be defined in single HTTPRoute)
Example 3. Configure TLS termination
Before — Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tls-ingress
namespace: demo-apps
spec:
ingressClassName: nginx
tls:
- hosts:
- secure.example.com
secretName: tls-secret
rules:
- host: secure.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: secure-svc
port:
number: 80
After — Gateway + HTTPRoute
In Gateway API, TLS configuration is defined in listener of Gateway resource. HTTPRoute handles only routing rules.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: nginx-gateway
namespace: nginx-gateway
spec:
gatewayClassName: nginx
listeners:
- name: https
port: 443
protocol: HTTPS
hostname: secure.example.com
tls:
mode: Terminate
certificateRefs:
- name: tls-secret
allowedRoutes:
namespaces:
from: All
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: secure-route
namespace: demo-apps
spec:
parentRefs:
- name: nginx-gateway
namespace: nginx-gateway
sectionName: https
hostnames:
- secure.example.com
rules:
- backendRefs:
- name: secure-svc
port: 80
Key changes:
- Ingress
spec.tls→ configure TLS termination in Gatewaylisteners[].tls - TLS certificate (Secret) is managed by Gateway, HTTPRoute defines only routing
- Reference specific listener using
parentRefs.sectionName
Step 2. Perform migration
Convert existing Ingress resources to Gateway API following order: parallel run → validate → switch.
1. Create HTTPRoute resource
Create an HTTPRoute corresponding to the existing Ingress using the automatic conversion result or the manual conversion examples.
kubectl --kubeconfig=$KUBECONFIG apply -f httproute-path.yaml
kubectl --kubeconfig=$KUBECONFIG get httproute -n demo-apps
2. Run in parallel
Operate existing Ingress and new HTTPRoute simultaneously and verify traffic is handled correctly in both.
Ingress Controller and Gateway API Controller create separate load balancers, so they can operate simultaneously without interference. However, existing load balancer IP used by Ingress cannot be reused in Gateway API. Update DNS record to new load balancer address.
kubectl --kubeconfig=$KUBECONFIG get ingress -n demo-apps
kubectl --kubeconfig=$KUBECONFIG get gateway -n nginx-gateway -o jsonpath='{.items[0].status.addresses[0].value}'
3. Switch traffic and delete Ingress
After verifying that traffic is handled correctly through Gateway API, update DNS to the Gateway load balancer address, then delete the existing Ingress resource.
kubectl --kubeconfig=$KUBECONFIG delete ingress path-routing -n demo-apps
Deleting Ingress resource stops traffic through existing Ingress Controller load balancer. Verify Gateway API traffic works correctly before deletion.
4. Roll back plan
If an issue occurs after migration, restore the Ingress resources backed up in the prerequisites.
kubectl --kubeconfig=$KUBECONFIG apply -f ingress-backup.yaml
kubectl --kubeconfig=$KUBECONFIG delete httproute path-routing -n demo-apps
Restore DNS to original Ingress load balancer address.
Keep existing Ingress Controller until Gateway API traffic is fully stabilized to allow rollback.
Step 3. Verify migration
1. Check Gateway and HTTPRoute status
Verify Gateway has ADDRESS assigned and PROGRAMMED: True, and HTTPRoute has Accepted: True.
kubectl --kubeconfig=$KUBECONFIG get gateway -n nginx-gateway
kubectl --kubeconfig=$KUBECONFIG describe httproute path-routing -n demo-apps
Status:
Parents:
Conditions:
Message: The route is accepted
Reason: Accepted
Status: True
Type: Accepted
Message: All references are resolved
Reason: ResolvedRefs
Status: True
Type: ResolvedRefs
2. Validate routing behavior
Check routing using Gateway ADDRESS.
export GW_ADDRESS=$(kubectl --kubeconfig=$KUBECONFIG get gateway nginx-gateway -n nginx-gateway -o jsonpath='{.status.addresses[0].value}')
echo $GW_ADDRESS
curl -v http://$GW_ADDRESS/api
curl -v http://$GW_ADDRESS/web
curl -v http://$GW_ADDRESS/ -H "Host: api.example.com"
curl -v http://$GW_ADDRESS/ -H "Host: web.example.com"
curl -v https://$GW_ADDRESS/ -H "Host: secure.example.com" --insecure
If each request is routed to correct backend service, migration is successfully completed.
After migration, remove unused Ingress Controller resources (Deployment, Service, IngressClass) to prevent unnecessary resource usage. For troubleshooting, see Gateway API migration troubleshooting.