Multiple Frontends using Istio Ingress and Route Rules

3/9/2018

Is it possible to do the traffic routing using the route rules as described in the image below? The traffic routing would need to happen right after the traffic enters the cluster.

enter image description here

We have been fiddling around with them but always hit a wall as soon as we had two route rules and used a uri regex in one of the rules.

Our idea is to configure the istio ingress like so

# Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gateway
  annotations:
    kubernetes.io/ingress.class: "istio"
spec:
  backend:
    serviceName: frontend
    servicePort: 8080

And then configure the route rules that split the traffic depending on the uri header. Here is an example of how we would configure the products route rule:

apiVersion: config.istio.io/v1alpha2
kind: RouteRule
metadata:
  name: products-rule
spec:
  destination:
    name: frontend
  precedence: 2
  match:
    request:
      headers:
        uri:
          regex: "^/(?:.*?)/?products(?:/.*)?
quot;
route: - labels: fe-app: products

Is this setup possible with istio?

-- PhilippSpo
istio
kubernetes
kubernetes-ingress

1 Answer

3/9/2018

UPDATE: It seems Kubernetes Ingress does not support regular expressions, see https://github.com/kubernetes/ingress-nginx/issues/1360. So the answer below would not work.

I would create three different services: products, settings and customers and use Kubernetes Ingress fanout. I would use your regex expressions for the paths. I would try it first with a plain Kubernetes Ingress, without kubernetes.io/ingress.class: "istio" annotation. If it would work, I would add the Istio annotation and verify that it works as Istio Ingress as well.

-- Vadim Eisenberg
Source: StackOverflow