Mounting applications of different paths with Istio

3/2/2019

We have installed Istio on my Kubernetes cluster on AWS (we are using EKS). We have deployed several applications such as: Airflow, Jenkins, Grafana, etc. and we are able to reach them with port-forward. So, they are working as expected.

Now, what we would like to achieve is the possibility of mounting the applications on specific paths so that we can access them via an unique entrypoint.

Here an example to explain what I mean with "unique entrypoint":

What we tried is the following

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: apps-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: airflow-virtual-service  
spec:
  hosts:
  - "*"
  gateways:
  - apps-gateway
  http:
  - match:
    - uri:
        prefix: /airflow
    route:
    - destination:
        host: webserver.airflow.svc.cluster.local
        port:
          number: 8080
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-virtual-service  
spec:
  hosts:
  - "*"
  gateways:
  - apps-gateway
  http:
  - match:
    - uri:
        prefix: /grafana
    route:
    - destination:
        host: grafana.grafana.svc.cluster.local
        port:
          number: 3306
---
and so on

In this way but I keep having Aiflow 404 = lots of circles or similar depending on the service.

Do you know how to achieve such a result with Istio? We are also open to also use Nginx or Traefik.

-- spaghettifunk
istio
kubernetes
kubernetes-ingress
routing

1 Answer

3/2/2019

So based on the comments:

The best way to expose a frontend & backend it's to separate both with a wildcard domain like *.domain.com.

For the frontend:

my-app.domain.com/

For the backend services it will always start with a subdomain like api:

api.domain.com/foo

For backend service you will need to use rewrite if your backend service it's no serving the path.

rewrite:
  uri: "/"

Check Istio docs for more info about rewrite https://istio.io/docs/reference/config/istio.networking.v1alpha3/#Destination

-- Victor Godoy
Source: StackOverflow