I'm using the Azure AKS addon for HTTP application routing as described here. I deployed it using Terraform and it generally works:
resource "kubernetes_ingress" "ingress" {
metadata {
name = "nurse-ingress"
namespace = kubernetes_namespace.nurse.metadata[0].name
annotations = {
"kubernetes.io/ingress.class" = "addon-http-application-routing"
"nginx.ingress.kubernetes.io/rewrite-target" = "/$1"
}
}
wait_for_load_balancer = true
spec {
backend {
service_name = "nurse-service"
service_port = 80
}
rule {
host = "nurseapp.${azurerm_kubernetes_cluster.main.addon_profile[0].http_application_routing[0].http_application_routing_zone_name}"
http {
path {
backend {
service_name = kubernetes_service.app.metadata[0].name
service_port = 80
}
path = "/app/(.*)"
}
path {
backend {
service_name = kubernetes_service.nurse.metadata[0].name
service_port = 80
}
path = "/nurse/(.*)"
}
}
}
}
}
However, it only works on the default backend (i.e. path=/). When I call the URL on /nurse or /app it does not work since the rewrite-target /$1 does not seem to be taken into account. I will just get a 404 - since the nurse-service itself does expect calls on /foo and not on /nurse/foo
Should this be possible to configure to begin with and if so, any idea where my mistake is?
