<p>I have a simple Kubernetes cluster on kops and aws, which is serving a web app, there is a single html page and a few apis. They are all running as services. I want to expose all endpoints(html and apis) publicly for the web page to work.</p>

<p>I have exposed the html service as an LoadBalancer and I am also using nginx-ingress controller. I want to use the same LoadBalancer to expose the other apis as well(using a different LoadBalancer for each service seems like a bad and expensive way), it is something that I was able to do using Nginx reverse proxy in the on-premise version of the same application, by giving different paths for each api in the nginx conf file. </p>

<p>Although I am not able to do the same in the cluster, I tried <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">Service ingress</a> but somehow I am not able to get the desired result, if I add a path, e.g. "path:  "/mobiles-service"" and then add the specific service for it, the http requests do not somehow get redirected to the service. Only the html service works on the root path. Any help would be appreciated.</p>

<p>First you need to create controller for your Kops cluster running on AWS</p>

<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/ingress-nginx/v1.6.0.yaml
</code></pre>

<p>Then check if ingress-nginx service is created by running:</p>

<pre><code>kubectl get svc ingress-nginx -n kube-ingress
</code></pre>

<p>Then create your pods and ClusterIP type services for your <strong>each app</strong> like sample below:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: app1-service
spec:
  selector:
    app: app1
  ports:
    - port: &lt;app-port&gt;
</code></pre>

<p>Then create ingress rule file like sample below:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
        - path: /app1
          backend:
            serviceName: app1-service
            servicePort: &lt;app1-port&gt;
        - path: /app2
          backend:
            serviceName: app2-service
            servicePort: &lt;app2-port&gt;
</code></pre>

<p>Once you deploy this ingress rule yaml, Kubernetes creates an Ingress resource on your cluster. The Ingress controller running in your cluster is responsible for creating an HTTP(S) Load Balancer to route all external HTTP traffic (on port 80) to the App Services in backend you exposed on specified pathes.</p>

<p>You can see newly created ingress rule by running:</p>

<pre><code>kubectl get ingress
</code></pre>

<p>And you will see output like below:</p>

<pre><code>NAME              HOSTS   ADDRESS                                                                  PORTS   AGE
example-ingress   *       a886e57982736434e9a1890264d461398-830017012.us-east-2.elb.amazonaws.com   80      1m
</code></pre>

<p>In relevant path like <code>http://external-dns-name/app1</code> and <code>http://external-dns-name/app2</code> you will access to your apps and in root <code>/</code> path, you will get <code>&lt;default backend - 404&gt;</code></p>
