我们正在使用 Prometheus 运算符,我们需要使用 istio 公开(外部)公开 Grafana,https://github.com/helm/charts/tree/master/stable/prometheus-operator https://github.com/helm/charts/tree/master/stable/prometheus-operator
通常,当我有需要使用 istio 公开公开的应用程序时,我会在我的微服务中添加如下内容它有效并暴露在外。
服务.yaml
apiVersion: v1
kind: Service
metadata:
name: po-svc
namespace: po
spec:
ports:
- name: http
port: 3000
targetPort: 3000
selector:
app: myapp //I take the name from deployment.yaml --in the chart NOT SURE WHICH VALUE I SHOULD TAKE FROM THE CHART---
并添加虚拟服务
虚拟服务.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: po-virtualservice
namespace: po
spec:
gateways:
- gw-system.svc.cluster.local
hosts:
- po.eu.trial.appos.cloud.mvn
http:
- route:
- destination:
host: po-svc
port:
number: 3000
然后我就可以访问我的应用程序publicly.
现在我想从普罗米修斯操作员图表中对 Grafana 进行同样的操作
in the values.yaml
有服务入口
https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576 https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576但不确定是否应该取代service.yaml
如果是的话如何填写数据app: myapp
(在常规应用程序中,我从deployment.yaml中的“名称”字段中获取)是服务引用Grafana应用程序的grafana
此外,在virutalservice.yaml
有一个参考service
(主办方:po-svc)
我的问题是:我应该如何填写这些两个值并能够
使用 istio 暴露 Grafana ?
顺便说一句,如果我改变图表中的值 https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576 to LoadBalancer
如下所示,我获得了一个可以外部访问的公共 url,但是我想通过 istio 公开它。
service:
portName: service
type: LoadBalancer
update
我创建了以下虚拟服务
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: po-virtualservice
namespace: po
spec:
gateways:
- gw-system.svc.cluster.local
hosts:
- po.eu.trial.appos.cloud.mvn
http:
- route:
- destination:
host: po-grafana. // This is the name of the service that promethues operator created when applying the chart .
port:
number: 3000
并更新值.yaml https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576喜欢关注
service:
portName: service
port: 3000
targetPort: 3000
现在,当我在浏览器中输入应用程序 url (po.eu.Trial.appos.cloud.mvn) 时,出现错误
upstream connect error or disconnect/reset before headers. reset reason: connection termination
知道可能是什么问题吗?我应该如何追踪这个问题?
我想(不确定100%)我可能遗漏了一些东西服务配置中 chart https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576但不确定是什么...
我发现这篇文章有类似的错误:(但不确定我们有同样的问题)
https://github.com/istio/istio/issues/19966 https://github.com/istio/istio/issues/19966
但不确定我应该如何将名称端口添加到图表yaml https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576服务定义