<p>Following <a href="https://www.pulumi.com/docs/guides/crosswalk/kubernetes/app-services/" rel="nofollow noreferrer">this pulumi walkthrough</a>, I need to expose 2 services: <code>kuard</code> and <code>rstudiogp</code> through an nginx ingress controller. The kuard app is just there to demonstrate that kubernetes is up , the rstudio app is something I'd like to add to the cluster.</p>
<p>I would like to access the kuard service at <code>apps.example.com</code>, and the rstudio service at <code>apps.example.com/rstudio</code>. However, I was only able to have both online at the same time by changing one of the hosts to for example <code>apps.example.rstudio.com</code>, so I have 2 hosts rather than one.</p>
<p>Isn't it possible to use ingress paths to expose two services using the same ingress rule? How to use the same hostname to access both services with different paths, e.g. <code>apps.example.com/kuard</code> and <code>apps.example.com/rstudio</code>?</p>
<p><code>curl -Lv -H 'Host: apps.example.com' &lt;PUBLIC-IP&gt;</code>.</p>
<p>Current Kuard ingress:</p>
<pre><code>// Create the kuard Ingress
const ingress = new k8s.extensions.v1beta1.Ingress(namekuard,
   {
        metadata: {
            labels: labels,
            namespace: namespaceName,
            annotations: {&quot;kubernetes.io/ingress.class&quot;: &quot;nginx&quot;},
       },
        spec: {
            rules: [
                {
                    host: &quot;apps.example.com&quot;,
                    http: {
                        paths: [
                           {
                                path: &quot;/&quot;,
                               backend: {
                                    serviceName: serviceName,
                                    servicePort: &quot;http&quot;,
                                }
                           },
                        ],
                    },
                }
            ]
        }
    },
    {provider: clusterProvider}
);
</code></pre>
<p>Current RStudio ingress (see the annotated lines that I tried without success):</p>
<pre><code>const ingress_rs = new k8s.extensions.v1beta1.Ingress(rsname,
    {
        metadata: {
            labels: labels_rs,
            namespace: namespaceName,
            annotations: {&quot;kubernetes.io/ingress.class&quot;: &quot;nginx&quot;},
        },
        spec: {
            rules: [
                {
                    host: &quot;apps.example.rstudio.com&quot;,
                    http: {
                        paths: [
                            {
                               path: &quot;/&quot;,
                               backend: {
                                   serviceName: serviceName_rs,
                                   servicePort: &quot;http&quot;,
                               }
                           },
//                            {
//                                path: &quot;/rstudio&quot;,
//                                pathType: &quot;Prefix&quot;,
//                                backend: {
//                                    serviceName: serviceName_rs,
//                                    servicePort: &quot;http&quot;,
//                                }
//                            },
                        ],
                    },
                }
            ]
        }
    },
    {provider: clusterProvider}
);
</code></pre>

gaut
<p>Found out that the problem was with my application expecting to be served from the root url.</p>
