Deep explanation of how NGINX Ingress routes internet traffic to your ClusterIP Service on AKS, including Azure-specific placeholders like the hostname and DNS mapping.
Host + Path → Service
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: spring-ui-api-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: REPLACEME_HOSTNAME
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: spring-ui-api-svc
port:
number: 80
spring-ui-api.mycompany.com
or a temporary domain like:
spring-ui-api.<yourdnszone>.
apiVersion: networking.k8s.io/v1 is the stable Ingress API version.kind: Ingress defines L7 (HTTP/HTTPS) routing rules for an ingress controller.NGINX-specific annotation that rewrites the request URI before proxying to your backend service.
//”.
In more complex setups (e.g., hosting multiple apps under /app1, /app2),
rewrite rules prevent backend apps from needing awareness of the external path prefix.
path: / and pathType: Prefix, rewriting to / is often harmless,
but in some applications it can break deep-linking if you later change the path to something like /ui.
Keep it only if you need path prefix hosting.
Tells Kubernetes which ingress controller should implement this Ingress resource.
nginx should watch and configure routing for this Ingress.”
In AKS this is typically the community NGINX Ingress Controller installed via Helm or YAML.
Host-based routing means the Ingress rule matches the HTTP Host header
(what the browser requests, e.g., spring-ui-api.mycompany.com).
spring-ui-api.dev.mycompany.comspring-ui-api.qa.mycompany.comspring-ui-api.prod.mycompany.comService type: LoadBalancer.
Prefix, requests like /, /architecture, /actuator/health
all match and route to the backend.
/”.
This is the broadest match and effectively routes all paths.
The Ingress proxies traffic to a Kubernetes Service, not directly to Pods. This gives stable service discovery, load balancing, and decoupling from Pod churn.
targetPort: 9087
and ultimately to the container port.
spring-ui-api.dev.yourcompany.com
LoadBalancer Service)spring-ui-api-svc
80
9087