2

我们使用 istio 已经有一段时间了,但最近发现了一个我们无法用异常值检测来解释的问题。我们有 50 多个微服务,并且发现其中一些“至少 2-3”流量似乎没有进行负载平衡,我们已将其追踪到异常值检测,因为一旦我们将其从目标规则中删除,负载平衡就可以正常工作。

该图像显示 1% 的流量流向以 8kh2p 结尾的 pod 我的主要问题是,即使我们可以复制问题并通过删除异常值检测来解决它,我们也没有看到任何指标显示断路器/异常值检测被绊倒了。根据这个 github 问题 - https://github.com/istio/istio/issues/8902 - 我们应该能够使用类似于在此处输入图像描述

sum(istio_requests_total{response_code="503", response_flags="UO"}) by (source_workload, destination_workload, response_code) 

我还找到了一些特使文档,我应该可以在其中进行跟踪

envoy_cluster_circuit_breakers_default_cx_open

这些指标似乎都没有显示任何被触发的东西。

我确实想在stackoverflow.com上指出一个类似的帖子,它似乎没有解决我们的问题

如果有人可以通过异常值检测或至少一种我们可以跟踪其被绊倒的方式来帮助找出负载平衡不正确的原因,将不胜感激。-

kind: DestinationRule
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: some-service-dr
  namespace: some-namespace
spec:
  host: some-service.some-namespace.svc.cluster.local
  trafficPolicy:
    connectionPool:
      http:
        http1MaxPendingRequests: 1000
        idleTimeout: 3s
        maxRequestsPerConnection: 1
      tcp:
        maxConnections: 500
    outlierDetection:
      consecutive5xxErrors: 0 (disabling as our services expect 500s back)
      consecutiveGatewayErrors: 5 (502, 503, 504 should trigger this)
      interval: 10s
      maxEjectionPercent: 50
    tls:
      mode: ISTIO_MUTUAL

我们的虚拟服务看起来像

kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: some-service-vs
  namespace: some-namespace
spec:
  hosts:
    - some-service.some-namespace.svc.cluster.local
  http:
    - retries:
        attempts: 5
        perTryTimeout: 30s
        retryOn: 'connect-failure,refused-stream,reset'
      route:
        - destination:
            host: some-service.some-namespace.svc.cluster.local
            port:
              number: 80
  exportTo:
    - .

对等身份验证

kind: PeerAuthentication
apiVersion: security.istio.io/v1beta1
metadata:
  name: some-service-tls-policy
  namespace: some-namespace
spec:
  selector:
    matchLabels:
      app: some-service
  mtls:
    mode: STRICT
  portLevelMtls: ~

Kubernetes 版本 v1.21.x

Istio 版本 1.10.x

普罗米修斯 2.28.x 版

更新

我已经更新了我们的目标规则,尝试将 Continuous5xxErrors 和 ContinuousGatewayErrors 都更改为 0,但问题仍然存在,有 2 个 Pod,一个 Pod 占用 100% 的流量,而另一个 Pod 没有负载均衡。下面的新设置

outlierDetection:
  interval: 10s
  maxEjectionPercent: 50
4

0 回答 0