首页 > 解决方案 > 两个不同网格之间的 gRPC 连接被重置

问题描述

我有两个不同的集群(EKS,v1.18),它们有自己的网格(v1.9.0)。

我在集群 A 上有一个 Thanos 部署,在集群 B 上有一个 Prometheus 部署(也运行了 thanos sidecar)。目标是让 thanos 通过内部负载均衡器(ELB 经典)查询远程集群中的这些 sidecar,以代理对每个集群的查询(使用 S3 或类似的块持久性超出此问题的范围)

Gateway、Virtual Service 和 Service 的资源都在集群 B 中,我可以在连接到网络后在本地运行 Thanos,并使用 gRPC 成功连接到集群 B 中的 sidecar。

集群 B 的 FQDN 的 ServiceEntry 已在集群 A 中创建,解析有效,路由正确,但集群 A 中的部署无法连接到集群 B。

Istio sidecars(来自集群 A 中的源工作负载 Thanos)显示连接正在被重置:

[2021-02-26T14:41:03.509Z] "POST /thanos.Store/Info HTTP/2" 0 - http2.remote_reset - "-" 5 0 4998 - "-" "grpc-go/1.29.1" "50912787-d528-994f-b8ad-78dd42081fea" "thanos.dev.integrations.internal.fqdn:10901" "-" - - 172.20.65.175:10901 172.30.9.174:37594 - default

我没有在集群 B 的入口网关中看到传入请求(我有一个公共的和一个私有的,我检查了两者以确保)。

我努力了:

资源(A 组)

服务入口:

---
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
  name: thanos-integrations-dev
  namespace: thanos
spec:
  hosts:
  - thanos.dev.integrations.internal.fqdn
  location: MESH_EXTERNAL
  ports:
  - name: grpc-thanos-int-dev
    number: 10901
    protocol: GRPC
  resolution: DNS

资源(B 组)

网关:

---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  annotations:
    meta.helm.sh/release-name: istio-routing-layer
    meta.helm.sh/release-namespace: istio-system
  creationTimestamp: "2021-02-25T11:37:49Z"
  generation: 3
  labels:
    app.kubernetes.io/instance: istio-routing-layer
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: istio-routing-layer
    app.kubernetes.io/version: 0.0.1
    helm.sh/chart: istio-routing-layer-0.0.1
  name: thanos
  namespace: istio-system
spec:
  selector:
    istio: internal-ingressgateway
  servers:
  - hosts:
    - thanos.dev.integrations.internal.fqdn
    port:
      name: grpc-thanos
      number: 10901

虚拟服务:

---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  annotations:
    meta.helm.sh/release-name: istio-routing-layer
    meta.helm.sh/release-namespace: istio-system
  creationTimestamp: "2021-02-25T11:37:49Z"
  generation: 3
  labels:
    app.kubernetes.io/instance: istio-routing-layer
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: istio-routing-layer
    app.kubernetes.io/version: 0.0.1
    helm.sh/chart: istio-routing-layer-0.0.1
spec:
  gateways:
  - thanos
  hosts:
  - thanos.dev.integrations.internal.fqdn
  http:
  - route:
    - destination:
        host: thanos-sidecar.prometheus.svc.cluster.local
        port:
          number: 10901

服务:

---
apiVersion: v1
kind: Service
metadata:
  annotations:
    meta.helm.sh/release-name: prometheus-thanos-istio
    meta.helm.sh/release-namespace: prometheus
  creationTimestamp: "2021-02-25T14:31:02Z"
  labels:
    app.kubernetes.io/instance: prometheus-thanos-istio
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: prometheus-thanos-istio
    app.kubernetes.io/version: 0.0.1
    helm.sh/chart: prometheus-thanos-istio-0.0.1
spec:
  clusterIP: None
  ports:
  - name: grpc-thanos
    port: 10901
    protocol: TCP
    targetPort: grpc
  selector:
    app: prometheus
    component: server
  sessionAffinity: None
  type: ClusterIP

标签: kubernetesistioistio-sidecarthanos

解决方案


推荐阅读