Why I can't expose the grafana that comes from istio with Istio Gateway?

8/14/2018

I am using helm to install istio-1.0.0 version with --set grafana.enabled=true.

To access the grafana dashboard, I have to do port forwarding using kubectl command. It works okay. However, i want to access it using public ip, hence I am using this gateway yaml file

---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
  namespace: agung-ns
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 15031
      name: http-grafana
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-global-route
  namespace: agung-ns
spec:
  hosts:
  - "grafana.domain"
  gateways:
  - grafana-gateway
  - mesh
  http:
  - route:
    - destination:
        host: "grafana.istio-system"
        port: 
          number: 3000
      weight: 100

I tried to curl it, but it returns 404 status, which means something wrong with routing logic and/or my configuration above.

curl -HHost:grafana.domain http://<my-istioingressgateway-publicip>:15031 -I
HTTP/1.1 503 Service Unavailable
date: Tue, 14 Aug 2018 13:04:27 GMT
server: envoy
transfer-encoding: chunked

Any idea?

-- Agung Pratama
istio
kubernetes

2 Answers

1/10/2019

I did expose it like this:

grafana.yml

---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "my.dns.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-vts
  namespace: istio-system
spec:
  hosts:
  - "my.dns.com"
  gateways:
  - grafana-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: grafana
        port: 
          number: 3000

then:

kubectl apply grafana.yml

-- Victor Godoy
Source: StackOverflow

9/24/2018

I think the problem is that you refer service in different namespace. You need to add FQDN (grafana.istio-system.svc.cluster.local).

If you need istio, grafana, prometheus and jaeger integrated, exposed through gateway and with enabled security you can check the project I am working on: https://github.com/kyma-project/kyma

-- Piotr Bochynski
Source: StackOverflow