使用 istio 公开公开 grafana

2023-12-30

我们正在使用 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服务定义


istio 有一个版本 1.7.0 的工作示例

istioctl version
client version: 1.7.0
control plane version: 1.7.0
data plane version: 1.7.0 (1 proxies)

1.我用过取舵 https://v2.helm.sh/docs/helm/#helm-fetch获取普罗米修斯操作员。

helm fetch stable/prometheus-operator --untar

2.我在values.yaml中更改了这些。

Grafana Service https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L576.

service:
  portName: http-service
  port: 3000
  targetPort: 3000

Grafana host https://github.com/helm/charts/blob/master/stable/prometheus-operator/values.yaml#L514.

hosts:
  - grafana.domain.com

3.我已经创建了 po 命名空间并安装了 prometheus 运算符

kubectl create namespace po
helm install prometheus-operator ./prometheus-operator -n po

4.我已经检查了grafana服务名称

kubectl get svc -n po
prometheus-operator-grafana                    ClusterIP

5.我在istio中使用了下面的yaml,使用的grafana服务名称是prometheus-operator-grafana作为我的虚拟服务和目标规则主机。

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
  namespace: po
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http-grafana
      protocol: HTTP
    hosts:
    - "grafana.domain.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-vs
  namespace: po
spec:
  hosts:
  - "grafana.domain.com"
  gateways:
  - grafana-gateway
  http:
  - route:
    - destination:
        host: prometheus-operator-grafana.po.svc.cluster.local
        port:
          number: 3000
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: grafana
  namespace: po
spec:
  host: prometheus-operator-grafana.po.svc.cluster.local
  trafficPolicy:
    tls:
      mode: DISABLE

5.用curl测试,它是302而不是200,因为我们必须登录。

curl -v -H "host: grafana.domain.com" xx.xx.xxx.xxx/

GET / HTTP/1.1
> Host: grafana.domain.com
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 302 Found

如果它有效或者您有任何其他问题,请告诉我。可能你使用的1.4.3版本有问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 istio 公开公开 grafana 的相关文章

随机推荐

  • 如何在 vue bootstrap 中启用悬停下拉菜单?

    div div
  • 事件处理程序为空

    我正在尝试从用户控件引发单击事件并在包含页面上处理它 我遇到的问题是 当我单击用户控件上的按钮 imgstep1 时 imgstep1 click 事件后面的代码会触发 但 btnHandler 事件始终为空 因此它不会调用父事件 对此的任
  • C# 与 C++ 等效的空合并运算符

    C 空合并运算符是否有 C 等效项 我在代码中做了太多空检查 因此正在寻找一种减少空代码量的方法 我刚刚发现这个 这 运算符又名空合并运算符 http dev tricks net the operator aka null coalesc
  • 如果 C 有指针,为什么还需要数组?

    如果我们可以使用指针malloc创建和使用数组 为什么C中存在数组类型 如果我们可以使用指针来代替 那不是没有必要了吗 数组比动态内存分配更快 数组在 编译时 分配 而 malloc 在运行时分配 分配需要时间 另外 C 并没有强制要求ma
  • Java 8方法引用:提供能够提供参数化结果的Supplier

    我想用 java util Optional orElseThrow 具有要求构造函数参数的异常类型 像这样的事情 orElseThrow MyException new someArgument obviously NOT working
  • 从 C 文本文件中读取 int 值

    我有一个包含以下三行的文本文件 12 5 6 4 2 7 9 我可以使用fscanf函数读取前 3 个值并将它们存储在 3 个变量中 但我无法阅读其余部分 我尝试使用fseek函数 但它仅适用于二进制文件 请帮助我将所有值存储在整数变量中
  • 在 C# 中使用“dynamic”关键字无法编译

    我正在尝试编译一段 C 代码 其中包含dynamic关键词 我需要这个关键字来使用ironpython 但是 它无法编译 抱怨 error CS1980 Dynamic keyword requires System Runtime Com
  • 什么是 Nak 限制?

    我试图了解 Android Open Accessory API 如何与 Arduino ADK 板配合使用 我已经能够发送和接收信息 但我只想知道一切是如何工作的 我得到了这个函数的描述 int AndroidAccessory read
  • 错误测试应用内结算示例 - Dungeons

    我正在尝试获取应用程序内计费示例地下城 我有一个带有我的公共 ID 的草稿应用程序 并且我已经发布了非托管项目 potion 001 我在设备上使用与注册商家帐户相同的谷歌帐户 静态测试效果很好 但是当我尝试购买药水时 我得到 DEBUG
  • VBA中的数字上下控制

    vba 中是否有内置的数字 updown 控件 或者我们是否需要创建一个类似的控件 如果有这样的控件那么我们可以使用哪些事件 请建议 您可以使用SpinButton1对此进行控制 SNAPSHOT CODE 您可以设置最小值和最大值Spin
  • 从列表更新选项菜单

    我的 GUI 中有一个 OptionMenu 它由一个列表填充 每次用户运行某个进程时 列表都会更新以反映这一点 有没有办法根据列表更新选项菜单 我试过了self plotWindow update as per 这个问题 https st
  • 如何将现有数据保留在 couchbase 中并且仅更新新数据而不覆盖

    因此 假设我在存储桶下创建了一些记录 文档 并且用户仅更新 RDBMS 中 10 列中的一列 因此我尝试仅发送该一列数据并在 couchbase 中更新它 但问题是 couchbase 会覆盖整个记录并为其余列设置 NULL 一种方法是从
  • 单击 JfreeChart 折线图按钮上的放大和缩小功能?

    基本上我希望线图被放大和缩小 总共4个按钮 2个用于X轴 放大和缩小 另外两个用于Y轴 沿着任何轴单击按钮 就像绘制图形一样在负 x 轴和负 Y 轴区域 根据数据点 然后单击按钮 图形应根据按钮单击沿负 x 轴或负 Y 轴放大和缩小 我怎样
  • 强制应用程序在特定的 .NET 运行时版本下运行?

    我安装了 NET 2 0 运行时 然后安装了 NET 4 0 运行时 所以我两者都有 当我运行 NET 应用程序时 有没有办法强制使用哪个运行时 编辑 澄清 我的意思是不考虑应用程序的构建方式 我假设 NET 4 0 运行时可以运行 5 年
  • OpenSSL::SSL::SSLError: SSL_connect SYSCALL 返回=5 errno=0 状态=SSLv3 读取服务器问候 A

    下面的代码产生以下错误 OpenSSL SSL SSLError SSL connect SYSCALL returned 5 errno 0 state SSLv3 read server hello A require net http
  • 获取 Bash 数组中值的索引

    我有东西在bash like myArray red orange green 我想做一些类似的事情 echo myArray green 在这种情况下会输出2 这是可以实现的吗 这将做到这一点 bin bash my array red
  • C# 7 本地函数:是否允许属性/方面?

    C 7 引入了本地函数 这太棒了 假设我有以下代码 using System using PostSharp Aspects namespace AspectCS7 class Program private static void Mai
  • 对数组中存储的数据进行搜索(运算符不存在:整数[] = 整数)

    我有一个名为 InfoData 的 Rails 模型 它有一个名为 error codes 的属性 代码存储在数组中 如 9 7 10 21 integer 回顾一下 InfoData first error codes gt 9 7 5
  • 有时 F# 不会内联函数,即使它被标记为“内联”?

    let inline funA x printf A x gt 3 let inline funB myFun x printf B myFun x let foo funB funA 7 IL for foo method public
  • 使用 istio 公开公开 grafana

    我们正在使用 Prometheus 运算符 我们需要使用 istio 公开 外部 公开 Grafana https github com helm charts tree master stable prometheus operator