<p>I am using AKS with Helm v2.2 to try deploying a chart that utilizes an nginx LoadBalancer Pod to control all ingress into my services via a single ip address. This is very much in the experimental phase but I have proven that when I use the following Helm ingress configuration for my .net core webapi service:</p>

<pre><code>ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hosts:
    - host:
      paths:
        - /
</code></pre>

<p>That I can indeed then visit my exposed api and see the swagger ui at</p>

<pre><code>http://[My External IP]/index.html 
</code></pre>

<p>what I then want to do is place several services behind the same LoadBalancer (as you are intended to) so my expectations were that I could then change the above service configuration to something like this:</p>

<pre><code>ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hosts:
    - host:
      paths:
        - /serviceA
</code></pre>

<p>Which should then mean I can access the same service via the now updated url:</p>

<pre><code>http://[My External IP]/serviceA/index.html
</code></pre>

<p>Is this what I should be expecting to work? Do I need to use any sort of re-write system as so far I get errors back from this url saying that it cannot find certain missing resources. Any attempts at using the re-write annotation have not resulted in helping me here either. Could someone help me out and point out what I may be doing wrong? With the new url path I end up with the following types of errors on what appears to be the files that the index.html page is trying to load suggesting it is half working but needs some re-writing or something?</p>

<pre><code>Failed to load resource: the server responded with a status of 404 ()
</code></pre>

<p>As a result of the Helm chart template engine the following ingress yaml file is created:</p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: myrelease-release-manager
  labels:
    app.kubernetes.io/name: release-manager
    helm.sh/chart: release-manager-0.1.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "1.0"
    app.kubernetes.io/managed-by: Tiller
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /serviceA
    nginx.ingress.kubernetes.io/ssl-redirect: "false"

spec:
  rules:
    - host:
      http:
        paths:
          - path: /serviceA
            backend:
              serviceName: myrelease-release-manager
              servicePort: 80
</code></pre>

<p>As a result of this ingress file I want to visit this service when I go to my external ip address with the path /serviceA/index.html.</p>

The Senator
<p>Close, you need to update the rewrite target to /$2</p>

<pre><code>nginx.ingress.kubernetes.io/rewrite-target: /$2
</code></pre>

<p>Rewrites</p>

<p>/serviceB/foo -> /foo </p>

<p>/serviceA/foo -> /foo </p>

<p>But each one will be directed to the services for that path </p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: myrelease-release-manager
  labels:
    app.kubernetes.io/name: release-manager
    helm.sh/chart: release-manager-0.1.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "1.0"
    app.kubernetes.io/managed-by: Tiller
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
 spec:
   rules:
   - http:
       paths:
       - backend:
           serviceName: serviceB
           servicePort: 80
         path: /serviceB(/|$)(.*)
       - backend:
           serviceName: serviceA
           servicePort: 80
         path: /serviceA(/|$)(.*)
</code></pre>
