An ingress makes it easy to route traffic entering a Kubernetes cluster through a load balancer like NGINX. Beyond basic load balancing and TLS termination, an ingress can have rules for routing to different backends based on paths. The NGINX ingress controller also allows more advanced configurations such as URL rewrites.
In this post, we’ll use ingress rules and URL rewrites to route traffic between two versions of a REST API. Each version is deployed as a service (api-version1
and api-version2
). We will route traffic with path /api/v1
to api-version1
, and /api/v2
to api-version2
.
The sample application
We’ll be using a super simple ASP.NET Core application. Here’s the Configure()
method in Startup.cs
:
Read more at Anthony Chu