<p>I'm trying to try to match a host address to a service path, as an example, let's think i have an nginx pod servying to sites: site1 and site2. Let's think about a service called <strong>my-nginx-service</strong> which services my two sites as paths:</p>
<pre><code>- my-nginx-service (178.123.55.37:80) 
    - /site1
    - /site2
</code></pre>
<p>There exists a way to map it to something like:</p>
<pre><code>- host: site-one.mydomain.com
    http:
      paths:
      - backend:
          serviceName: nginx-service
          servicePort: 80
          servicePath: /site2
  - host: site-two.mydomain.com
    http:
      paths:
      - backend:
          serviceName: nginx-service
          servicePort: 80
          servicePath: /site2
</code></pre>
<p>? I have not found anything about it in docs. Or maybe I've not understood well them.</p>
<p>Thank you very much for your time!</p>

Xavis
<p>You can see from the output below of <code>kubectl explain</code> that the <code>servicePath</code> field above does not exist (at least on version 1.9.3). </p>

<p><code>kubectl explain ingress.spec.rules.http.paths.backend</code>:</p>

<pre><code>...
FIELDS:
   serviceName  &lt;string&gt; -required-
     Specifies the name of the referenced service.

   servicePort  &lt;string&gt; -required-
     Specifies the port of the referenced service.
...
</code></pre>

<p>You need to specify your path in the following field: <code>ingress.spec.rules.http.paths.path</code> so that when that path is hit the request is routed using the Service specified at <code>ingress.spec.rules.http.paths.backend.serviceName</code>. If you're using nginx or trafficserver ingress the annotation <code>nginx.ingress.kubernetes.io/rewrite-target: /</code> can be used to redirect the request to <code>/</code>.</p>
