how to add more than one service to ingress with url maps?

2/23/2018

Hi I have four microservices running and i want to use one ingress lb for all of those. Problem here is my ingress is working for only one microservice. but my application has some url like index.html. which means I have to access http:///index.html If I access http:/// (it shows white label page error) when I am using url-maps with path as path1 and I am trying to access http:///path1 (it shows white label page error). which means backend are working.But when I am try to access http:///path1/index.html it shows backend not found.

I need to know how to use url-maps in this case. Kindly help me out

-- Ram
backend
google-cloud-platform
kubernetes-ingress
url-mapping

1 Answer

2/24/2018

Here is an example extracted from the Kubernetes documentation [1] that creates 1 ingress load balancer that points to diferent backend services:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - path: /foo
        backend:
          serviceName: s1
          servicePort: 80
      - path: /bar
        backend:
          serviceName: s2
          servicePort: 80

You can add as many back end services as you need.

[1] https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout

-- Pol Arroyo
Source: StackOverflow