为什么我不能用 Istio Gateway 暴露来自 istio 的 grafana?

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

我正在使用 helm 安装 istio-1.0.0 版本--set grafana.enabled=true

要访问 grafana 仪表板,我必须使用 kubectl 命令进行端口转发。它工作正常。但是,我想使用 public ip 访问它,因此我正在使用此网关 yaml 文件

---
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

我尝试 curl 它,但是它 returns 404 状态,这意味着路由逻辑有问题 and/or 我上面的配置。

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

有什么想法吗?

我认为问题在于您引用了不同名称空间中的服务。您需要添加 FQDN (grafana.istio-system.svc.cluster.local).

如果您需要集成 istio、grafana、prometheus 和 jaeger,通过网关公开并启用安全性,您可以查看我正在处理的项目: https://github.com/kyma-project/kyma

我是这样曝光的:

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

然后:

kubectl apply grafana.yml