Kubernetes Ingress has been a common way to expose applications running inside a Kubernetes cluster. It allows developers to configure HTTP and HTTPS traffic routing, TLS termination, host-based routing, and path-based routing through a simple YAML resource.
However, as applications and infrastructure become more complex, the limitations of Ingress become noticeable. Advanced traffic management often depends on controller-specific annotations, and sharing traffic infrastructure between multiple application teams can become difficult to manage.
Kubernetes Gateway API provides a more expressive and role-oriented approach to managing network traffic. It separates infrastructure configuration from application routing and supports capabilities such as traffic splitting, header-based routing, redirects, and more advanced traffic management.
Migrating from Ingress to Gateway API requires more than converting YAML files. Developers must understand the new resource model, select a compatible Gateway implementation, map existing annotations, configure listeners and routes, and test the new traffic path before moving production traffic.
This article explains how to migrate existing Kubernetes Ingress resources to Gateway API with practical YAML examples and a production-oriented migration strategy.
Why Move From Kubernetes Ingress to Gateway API?
Kubernetes Ingress is a stable API that has been available since Kubernetes 1.19. However, its feature development has been frozen. The Kubernetes project recommends Gateway API for new traffic-management capabilities.
This does not mean that the Ingress API has been removed or deprecated. Existing Ingress resources continue to be supported under Kubernetes API stability guarantees. Organizations can continue using their existing Ingress controllers while planning a migration.
Gateway API addresses several limitations of the Ingress model.
Limited Built-In Routing Features
Ingress provides basic HTTP and HTTPS routing based on hostnames and URL paths.
For example, an Ingress resource can route requests to different Services based on the requested hostname or path.
However, advanced requirements such as traffic weighting, header-based routing, request modification, and more complex routing behavior often depend on controller-specific annotations or custom resources.
Gateway API provides many of these capabilities through structured API fields.
Controller-Specific Annotations
Different Ingress controllers implement additional features through their own annotations.
For example, one controller may use annotations to configure:
These annotations are not necessarily compatible with another Ingress controller.
When migrating between controllers, developers may need to rewrite a significant amount of configuration.
Gateway API provides standardized fields for many common traffic-management requirements. Features that are not standardized can be handled through implementation-specific policies and extension mechanisms.
Better Separation of Responsibilities
Ingress combines traffic entry configuration and application routing in a relatively simple resource model.
Gateway API separates these responsibilities into multiple resources.
For example:
Infrastructure providers manage GatewayClass resources.
Cluster operators and application administrators manage Gateway resources.
Application developers manage HTTPRoute resources.
This separation is useful when several teams share the same cluster infrastructure but need independent control over their application routes.
Understand the Gateway API Resource Model
Before migrating existing Ingress resources, understand the main Gateway API resources.
<text color="secondary">The following resources form the foundation of a typical HTTP application migration.</text>
Resource | Purpose | Comparable Ingress concept |
|---|
GatewayClass | Identifies the Gateway controller and its configuration class | IngressClass |
Gateway | Defines traffic entry points, listeners, and TLS configuration | Part of the Ingress controller configuration |
HTTPRoute | Defines hostname, path, and backend routing rules | Ingress rules |
ReferenceGrant | Allows references across namespaces under controlled conditions | No direct equivalent |
GatewayClass
A GatewayClass identifies the controller responsible for managing Gateway resources.
For example:
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: production-gateway
spec:
controllerName: example.com/gateway-controller
The controllerName must match the value supported by the Gateway implementation.
The example above is illustrative. It does not create a working Gateway controller by itself. Use the controller name documented by the implementation you install.
Gateway
A Gateway defines the infrastructure entry points through which external traffic enters the cluster.
It can configure:
For example, a Gateway can listen on port 80 for HTTP traffic and port 443 for HTTPS traffic.
HTTPRoute
An HTTPRoute defines how incoming HTTP requests are matched and forwarded to backend Services.
It supports:
The HTTPRoute attaches to a Gateway through parentRefs.
This separation allows an infrastructure team to manage the Gateway while application teams manage their own routing rules.
Prepare the Kubernetes Cluster for Gateway API
Gateway API is delivered through CustomResourceDefinitions (CRDs). Unlike the built-in Ingress API, installing a Gateway API implementation and its required CRDs is a separate step.
A Gateway API controller is also required. Installing the CRDs alone does not create a functioning traffic gateway.
Before starting migration, review these requirements:
A supported Kubernetes cluster.
A Gateway API implementation compatible with the cluster.
Gateway API CRDs installed at a compatible version.
An implementation-specific GatewayClass.
Access to the existing Ingress resources and controller configuration.
TLS certificates and backend Services.
A staging environment for testing.
Install Gateway API Standard CRDs
The Gateway API project provides Standard and Experimental release channels.
For a production migration, begin with the Standard channel unless a required feature is available only in the Experimental channel and your chosen controller explicitly supports it.
The following example installs the Gateway API v1.7.0 Standard CRDs:
kubectl apply --server-side \
-f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.7.0/standard-install.yaml
The version shown is an example of a release available in the current documentation. Check the release notes and compatibility requirements before selecting a version for your cluster.
Verify the installed CRDs:
kubectl get crds | grep gateway.networking.k8s.io
You should see resources such as:
gatewayclasses.gateway.networking.k8s.io
gateways.gateway.networking.k8s.io
httproutes.gateway.networking.k8s.io
referencegrants.gateway.networking.k8s.io
Install a Gateway API Controller
Gateway API defines the API specification, but it does not provide a default controller implementation.
You must select a compatible implementation to process Gateway and HTTPRoute resources.
Some available implementations include:
<Entity value="NGINX Gateway Fabric" category="software" disambig="Kubernetes Gateway API implementation"/>.
<Entity value="Envoy Gateway" category="software" disambig="Kubernetes Gateway API implementation"/>.
<Entity value="Istio" category="software" disambig="Service mesh and Kubernetes Gateway API implementation"/>.
<Entity value="Traefik" category="software" disambig="Cloud-native proxy and Gateway API implementation"/>.
<Entity value="Cilium" category="software" disambig="Kubernetes networking and Gateway API implementation"/>.
The installation procedure depends on the selected implementation. Some controllers install the required CRDs automatically, while others expect them to be installed separately.
Avoid installing multiple Gateway API implementations without understanding how their GatewayClasses and controllers will be managed.
Before selecting an implementation, review its conformance reports and supported feature list. Two implementations may support the same Gateway API version but differ in support for optional or extended features.
Understand the Differences Between Ingress and Gateway API
The most important migration step is understanding how existing Ingress fields map to Gateway API resources.
Ingress configuration | Gateway API equivalent |
|---|
IngressClass
| GatewayClass
|
Ingress TLS configuration | Gateway HTTPS listener |
Ingress hostname | HTTPRoute hostnames |
Ingress path | HTTPRoute matches.path |
Ingress backend Service | HTTPRoute backendRefs |
Ingress controller selection | HTTPRoute parentRefs |
TLS redirect annotation | HTTPRoute RequestRedirect filter |
Traffic splitting annotation | HTTPRoute weighted backendRefs |
Header routing annotation | HTTPRoute header matches |
There are some important differences.
In Ingress, the controller generally provides implicit HTTP and HTTPS entry points. In Gateway API, listeners must be defined explicitly in a Gateway resource.
Ingress routing rules can include multiple hostnames. In Gateway API, hostname restrictions are defined through the hostnames field of HTTPRoute resources and must match the hostname configuration of the selected Gateway listener.
The default backend also requires attention. Gateway API does not have a direct equivalent to the Ingress default backend field. You normally create an explicit HTTPRoute rule that matches the required fallback path.
Migrate an Existing Ingress Resource to Gateway API
Let's use a practical example.
Assume an application has two hostnames:
api.example.com
admin.example.com
The existing Ingress configuration routes traffic as follows:
Hostname | Path | Backend Service |
|---|
api.example.com | /orders
| orders-service |
api.example.com | /
| api-service |
admin.example.com | /
| admin-service |
The application uses TLS termination and redirects HTTP requests to HTTPS.
Existing Ingress Configuration
The following YAML represents the current Ingress resource.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: application-ingress
namespace: production
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName: nginx
tls:
- hosts:
- api.example.com
- admin.example.com
secretName: application-tls
rules:
- host: api.example.com
http:
paths:
- path: /orders
pathType: Prefix
backend:
service:
name: orders-service
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: api-service
port:
number: 80
- host: admin.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: admin-service
port:
number: 80
This resource defines the existing routing behavior.
The TLS certificate and private key are stored in a Kubernetes Secret named application-tls.
The ssl-redirect annotation is specific to the NGINX Ingress implementation. It must be mapped to an equivalent feature in the selected Gateway implementation.
We will now create equivalent Gateway API resources.
Step 1: Create a Gateway Resource
The Gateway resource defines the HTTP and HTTPS listeners.
Create a file named application-gateway.yaml.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: application-gateway
namespace: production
spec:
gatewayClassName: production-gateway
listeners:
- name: http
protocol: HTTP
port: 80
hostname: "*.example.com"
allowedRoutes:
namespaces:
from: Same
- name: https
protocol: HTTPS
port: 443
hostname: "*.example.com"
tls:
mode: Terminate
certificateRefs:
- name: application-tls
allowedRoutes:
namespaces:
from: Same
This Gateway defines two listeners.
The HTTP listener accepts traffic on port 80.
The HTTPS listener accepts traffic on port 443 and terminates TLS using the certificate stored in the application-tls Secret.
The wildcard hostname allows subdomains under example.com, including both application hostnames.
The allowedRoutes setting restricts route attachment to resources in the same namespace.
Because the Secret is referenced by a Gateway listener, it must be accessible in the Gateway's namespace according to the Gateway API reference rules. In this example, both the Gateway and Secret belong to production.
The gatewayClassName must match a GatewayClass supported by the installed controller.
Apply the resource:
kubectl apply -f application-gateway.yaml
Step 2: Create HTTPRoute Resources
In Gateway API, routing rules are separated from the Gateway.
We will create one HTTPRoute for the API hostname and another for the admin hostname.
API HTTPRoute
Create api-route.yaml:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: api-route
namespace: production
spec:
parentRefs:
- name: application-gateway
sectionName: https
hostnames:
- api.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /orders
backendRefs:
- name: orders-service
port: 80
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: api-service
port: 80
The route attaches to the HTTPS listener using parentRefs.
The hostnames field restricts the route to api.example.com.
The first rule sends requests beginning with /orders to orders-service.
The second rule sends requests beginning with / to api-service.
The more specific path takes precedence over the broader path when both match.
Admin HTTPRoute
Create admin-route.yaml:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: admin-route
namespace: production
spec:
parentRefs:
- name: application-gateway
sectionName: https
hostnames:
- admin.example.com
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: admin-service
port: 80
This route sends requests for admin.example.com to the admin-service backend.
Apply both resources:
kubectl apply -f api-route.yaml
kubectl apply -f admin-route.yaml
The existing Kubernetes Services remain unchanged. Only the external traffic-routing configuration is being migrated.
Step 3: Configure HTTP-to-HTTPS Redirects
The original Ingress resource used an NGINX annotation to redirect HTTP traffic to HTTPS.
Gateway API supports this behavior through the RequestRedirect filter.
Create a file named https-redirect.yaml.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: https-redirect
namespace: production
spec:
parentRefs:
- name: application-gateway
sectionName: http
hostnames:
- api.example.com
- admin.example.com
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
port: 443
statusCode: 301
This HTTPRoute attaches to the HTTP listener and redirects matching requests to HTTPS.
Apply it:
kubectl apply -f https-redirect.yaml
This replaces the behavior of the previous NGINX TLS redirect annotation for the two hostnames.
Remember that a Gateway controller must support the relevant Gateway API feature and correctly provision its data plane before the redirect can work.
Step 4: Verify Gateway and Route Status
After applying the resources, verify that the Gateway controller has accepted the configuration.
Check the Gateway:
kubectl get gateway application-gateway \
-n production
Inspect its detailed status:
kubectl describe gateway application-gateway \
-n production
Check the HTTPRoutes:
kubectl get httproutes \
-n production
Inspect a route:
kubectl describe httproute api-route \
-n production
Gateway API resources expose status conditions that help identify whether the controller has accepted and programmed the configuration.
Important conditions include:
Condition | Meaning |
|---|
Accepted
| The controller has accepted the resource configuration |
Programmed
| The Gateway has been programmed by the implementation |
ResolvedRefs
| Referenced resources have been resolved successfully |
For an HTTPRoute, check whether it is accepted and whether its parent reference is correctly attached.
A resource can exist in Kubernetes without being successfully implemented by the Gateway controller. Always inspect its status before testing application traffic.
Step 5: Test the New Gateway Before Production Cutover
Do not immediately remove the existing Ingress resource after creating the Gateway API configuration.
Run both traffic paths in parallel during migration.
The existing Ingress controller can continue serving production traffic while the new Gateway implementation is tested using its own address.
Retrieve the Gateway address:
kubectl get gateway application-gateway \
-n production \
-o jsonpath='{.status.addresses[*].value}'
The address may be an IP address or hostname, depending on the Gateway implementation.
Test the API hostname:
curl -i \
--resolve api.example.com:443:GATEWAY_IP \
https://api.example.com/orders
Test the admin hostname:
curl -i \
--resolve admin.example.com:443:GATEWAY_IP \
https://admin.example.com/
Replace GATEWAY_IP with the actual address returned by the Gateway status.
Test the HTTP redirect:
curl -I \
--resolve api.example.com:80:GATEWAY_IP \
http://api.example.com/orders
The response should contain a redirect status and a Location header pointing to HTTPS.
Also validate:
TLS certificate validity.
Hostname matching.
Path routing.
Backend health.
Authentication and authorization.
Request and response headers.
Application response times.
Access logs and error rates.
For production migrations, test all important routes rather than only the homepage or one API endpoint.
Migrate Ingress Annotations to Gateway API
One of the most important migration tasks is reviewing controller-specific annotations.
A basic Ingress resource may be easy to convert, but production applications often depend on many annotations.
Some common mappings are:
Ingress feature | Gateway API approach |
|---|
SSL redirect | RequestRedirect filter
|
URL rewrite | URLRewrite filter
|
Traffic splitting | Multiple weighted backendRefs |
Header-based routing | HTTP header matches |
Query parameter routing | Query parameter matches |
Request header modification | RequestHeaderModifier
|
Response header modification | ResponseHeaderModifier
|
Authentication | Implementation-specific policy or extension |
Rate limiting | Implementation-specific policy or extension |
Backend connection settings | Controller-specific policy or extension |
For example, a traffic-splitting rule can send 80% of traffic to one Service and 20% to another.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: canary-route
spec:
parentRefs:
- name: application-gateway
hostnames:
- api.example.com
rules:
- backendRefs:
- name: orders-v1
port: 80
weight: 80
- name: orders-v2
port: 80
weight: 20
This example demonstrates weighted backend routing.
The Gateway implementation distributes matching requests according to the configured weights. The weights represent relative proportions, not a guarantee that every small group of requests will follow an exact percentage.
Before converting an annotation, check whether the required behavior is part of the Gateway API Standard channel, an Extended feature, or a controller-specific extension.
Do not assume that every Ingress annotation has a direct Gateway API equivalent.
Use ingress2gateway for Automatic Conversion
Manually converting many Ingress resources can be time-consuming and error-prone.
The ingress2gateway project provides a conversion tool that can inspect existing Ingress resources and generate corresponding Gateway API resources.
It is particularly useful when migrating large clusters or applications with many hostnames and routing rules.
A typical migration workflow is:
Collect existing Ingress resources.
Identify the Ingress controller and its annotations.
Run the conversion tool using the appropriate provider.
Review the generated Gateway and HTTPRoute resources.
Correct unsupported or controller-specific behavior.
Apply the generated resources in a staging environment.
Test the resulting traffic paths.
The conversion tool should be treated as a starting point rather than a complete migration solution.
Some controller-specific annotations may not be converted automatically. Generated resources must be reviewed and tested against the selected Gateway implementation.
For Ingress-NGINX users, the Gateway API project provides a dedicated migration guide that explains additional considerations and available tooling.
Plan a Safe Production Migration
A successful migration should avoid unnecessary downtime.
The safest approach is to introduce the Gateway implementation alongside the existing Ingress controller and gradually move traffic.
Phase 1: Inventory Existing Ingress Resources
Collect all Ingress resources:
kubectl get ingress -A
Export the existing configuration:
kubectl get ingress -A -o yaml \
> ingress-backup.yaml
Review annotations:
kubectl get ingress -A -o json
Identify:
Hostnames and paths.
Backend Services and ports.
TLS Secrets.
Redirect rules.
Rewrite rules.
Authentication requirements.
Rate limits.
Timeouts.
Controller-specific configurations.
Do not begin conversion until you understand the behavior of the existing traffic path.
Phase 2: Install the Gateway Implementation
Install the selected Gateway controller and its compatible CRDs.
Create the required GatewayClass and Gateway resources.
Keep the existing Ingress controller running.
Phase 3: Convert and Validate Routes
Convert the Ingress resources into HTTPRoutes.
Review all generated YAML files and verify that backend Service names, ports, hostnames, and path matching are correct.
Test the new Gateway using its separate address.
Phase 4: Shift Production Traffic
After successful testing, gradually move traffic to the Gateway.
Depending on the infrastructure, this may involve:
Updating DNS records.
Changing an external load balancer.
Updating a cloud routing configuration.
Moving traffic through a controlled proxy.
Using a weighted traffic-management mechanism.
Reduce DNS TTL values ahead of a planned cutover when appropriate, and account for existing DNS caches and client connections.
Monitor application health and traffic behavior throughout the migration.
Phase 5: Remove the Old Ingress Configuration
Once the Gateway has served production traffic successfully and rollback is no longer required, remove the old Ingress resources and retire the previous controller according to your infrastructure plan.
Do not uninstall an Ingress controller while other applications still depend on it.
Keep a documented rollback procedure until the migration has been fully validated.
Common Migration Problems and Troubleshooting
Problem | Possible cause | Recommended solution |
|---|
Gateway remains Pending | Gateway controller is missing or cannot provision infrastructure | Check controller installation and GatewayClass |
GatewayClass is not accepted | Incorrect controller name or unsupported class | Verify the implementation's controller name |
HTTPRoute is not accepted | Route attachment or listener configuration is invalid | Inspect parentRefs, listener names, and allowed routes |
Route has unresolved references | Backend Service, port, or Secret reference is incorrect | Verify referenced resource names and namespaces |
TLS handshake fails | Incorrect certificate, hostname, or listener configuration | Check the TLS Secret and HTTPS listener |
Requests return 404 | Hostname or path does not match a route | Inspect HTTPRoute hostnames and match rules |
Redirect does not work | HTTPRoute is attached to the wrong listener or filter is unsupported | Check the HTTP listener and controller support |
Some annotations stop working | Annotation-specific functionality was not migrated | Map each feature to a standard field or implementation-specific policy |
Cross-namespace route fails | Listener does not allow the route namespace | Configure allowedRoutes and the required authorization resources |
New Gateway receives no traffic | External address or DNS is not configured correctly | Verify Gateway status, load balancer, and DNS |
A useful troubleshooting command is:
kubectl get gateway,httproute -A
For controller-specific errors, inspect the Gateway controller's logs:
kubectl logs \
-n gateway-system \
deployment/gateway-controller
The namespace and Deployment name depend on the selected implementation.
Best Practices for Gateway API Migration
Inventory every existing Ingress resource before starting migration.
Identify controller-specific annotations and custom resources.
Select a Gateway implementation based on required features and conformance support.
Install compatible Gateway API CRDs and controller versions.
Keep existing Ingress resources active during initial migration.
Separate infrastructure configuration from application routing.
Use Gateway listeners to define explicit HTTP and HTTPS entry points.
Use HTTPRoute resources to manage application hostnames and paths.
Verify cross-namespace permissions before referencing resources across namespaces.
Test TLS certificates and HTTP redirects independently.
Use ingress2gateway as a conversion aid, not as a replacement for manual review.
Test all application routes in staging before production cutover.
Monitor Gateway status conditions and controller logs.
Plan DNS and load-balancer changes to minimize traffic disruption.
Maintain a rollback plan until the new Gateway path is stable.
Review controller-specific extensions before assuming portability.
Advantages and Disadvantages of Gateway API
Advantages | Disadvantages |
|---|
More expressive routing capabilities | Requires installing and managing CRDs |
Clear separation of infrastructure and application responsibilities | Requires selecting a Gateway implementation |
Supports traffic splitting and advanced HTTP routing | Some features remain implementation-specific |
Reduces dependence on controller-specific annotations | Existing annotations may need manual conversion |
Supports multiple routing protocols through different route types | Migration requires planning and testing |
Provides standardized resource relationships | Controller capabilities can vary |
Offers a better foundation for shared infrastructure | Teams may need to learn a new resource model |
Conclusion
Kubernetes Gateway API provides a more flexible and expressive approach to managing application traffic than the traditional Ingress resource model. It separates infrastructure entry points from application routing and provides standardized support for capabilities such as redirects, traffic splitting, header matching, and URL rewriting.
Migrating from Ingress requires understanding the relationship between GatewayClass, Gateway, and HTTPRoute resources. Existing Ingress rules can often be converted directly, but controller-specific annotations and advanced features require additional review.
A safe migration should begin with an inventory of existing resources, followed by Gateway controller installation, route conversion, staging validation, and gradual production traffic cutover.
The Ingress API remains stable and is not scheduled for removal, so organizations do not need to migrate everything immediately. However, Gateway API provides a stronger foundation for new Kubernetes networking capabilities and is worth evaluating as part of a long-term infrastructure strategy.
Join the conversation! Your thoughts help the community grow.