【发布时间】:2020-12-20 16:14:43
【问题描述】:
我们正在使用 Prometheus 运算符,我们需要使用 istio 公开(外部)公开 Grafana, https://github.com/helm/charts/tree/master/stable/prometheus-operator
通常,当我有需要通过 istio 公开公开的应用程序时,我会在我的微服务中添加类似以下的内容它可以工作并在外部公开。
service.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---
并添加一个虚拟服务
virtualservice.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
然后我可以公开访问我的应用程序。
现在我想从 prometheus 操作符图表中为 Grafana 做同样的事情
在values.yaml中有服务入口
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 吗?
顺便说一句,如果我将values from the chart 更改为LoadBalancer 如下所示,我将获得一个公共 url 以访问外部,但是我想通过 istio 公开它。
service:
portName: service
type: LoadBalancer
更新
我创建了以下虚拟服务
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
并更新values.yaml,如下所示
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/istio/istio/issues/19966
但不确定如何将名称端口添加到 chart yaml 服务定义
【问题讨论】:
-
您的 istio 网关是否部署在与名称
egw-system.svc.cluster.local相同的命名空间中?你的 (PeerAuthentication)spec.mtls.mode使用 grafana 的命名空间是什么? -
@FL3SH - 是的,当然,我们在其他可以工作并公开公开的应用程序上使用此网关,考虑
PeerAuthentication不确定它是什么意思,我该如何检查,我应该运行任何k8s命令能实现吗?但不确定它与我的问题有什么关系:) -
如果您使用的是
spec.mtls.mode: stric,您必须为此服务禁用mTLS -
你自己创建了什么服务,命名为
po-svc,promethus-operator 应该为 grafana 创建服务? -
你能从部署 promtheus-operator 的命名空间中添加来自 kiali 的屏幕截图吗?另请检查您现在的 mTLS 配置是什么。
标签: kubernetes grafana kubernetes-helm istio prometheus-operator