lstio-1.9

明白了,你希望我给出一份 严格完整、官方级别的 Istio 排查文档,必须包含以下内容:

  1. Istio 核心组件全景

  2. 每次请求是否都需要 XDS 下发及其详细机制

  3. 流量与组件组合图(包括 XDS 下发过程)

  4. 完整排查命令、对应组件和作用说明

  5. 排查流程图(ASCII / 流程化文本版)

  6. 不乱删、不乱加,严格保留 Istio 核心逻辑和命令


Istio 完整排查文档(含 XDS 流程、组件、排查命令)


1️⃣ Istio 核心组件全景

组件功能部署位置排查命令/方法
Sidecar Envoy 拦截 Pod 内/外流量,执行路由、熔断、重试、故障注入、监控 每个 Pod 内 stats/config_dump/routes/logs/server_info
Istiod (Pilot) 下发 XDS 配置、服务发现、路由规则管理 Control Plane 通过 Sidecar server_info/config_dump 检查连接与配置
IngressGateway 外部流量入口 istio-system namespace kubectl logs / metrics / envoy stats
EgressGateway 外部流量出口 istio-system namespace kubectl logs / metrics / envoy stats
Citadel / Istio CA mTLS 证书管理 Control Plane 无直接命令
Mixer / Telemetry 收集指标和日志,执行策略(Istio 1.5+ 已合并) Control Plane Prometheus/Grafana 查看指标
VirtualService 流量路由规则 Namespace kubectl get/describe virtualservice
DestinationRule 流量策略、负载均衡、熔断 Namespace kubectl get/describe destinationrule
Gateway Ingress/Egress 配置 Namespace kubectl get/describe gateway
Service Kubernetes 服务抽象 Namespace kubectl get/describe svc
Endpoint Pod IP 列表 Namespace kubectl get/describe endpoints

2️⃣ XDS(Envoy Discovery Service)详细说明

2.1 XDS 类型与作用

类型缩写作用Sidecar 获取方式
Listener Discovery Service LDS 配置 Envoy 监听端口、协议和接入方式 config_dump -> listener 部分
Cluster Discovery Service CDS 配置 Envoy 上游服务集群 config_dump -> cluster 部分
Route Discovery Service RDS 配置路由规则(VirtualService) config_dump -> route 部分
Endpoint Discovery Service EDS 配置具体 Pod/Endpoint IP config_dump -> endpoint 部分
Secret Discovery Service SDS 配置 TLS/证书(mTLS) config_dump -> secret 部分

2.2 XDS 下发机制

  • XDS 并不是每次请求都下发

  • Sidecar Envoy 会缓存 XDS 配置,一旦配置发生变化(新 Pod/Service/路由策略更新、证书刷新)才会下发

  • 常见触发 XDS 更新的场景:

    1. 新 Pod 注册或 Pod IP 变更 → 触发 EDS 下发

    2. VirtualService/DestinationRule 更新 → 触发 RDS/CDS 下发

    3. Listener/Gateway 配置变更 → LDS 下发

    4. mTLS 证书更新 → SDS 下发

  • 每个请求直接使用缓存的配置,避免性能损耗

总结:XDS 是动态下发机制,不会每次请求都下发,只在配置变更时触发


3️⃣ 流量与组件组合图(ASCII 文本版)

      ┌─────────────┐
      │   Istiod    │
      │ (Pilot)     │
      └─────┬───────┘
            | XDS 下发
            v
      ┌──────────────┐
      │ Sidecar Pod A │
      │   Envoy       │
      └──────────────┘
       ^      |        ^
       |      |        |
       |      v        |
[IngressGW Envoy]       |
       ^                |
       |                |
[Client/外部请求]        |
       |                |
       v                |
  [Service / Endpoint] <-+
       |
       v
      Pod B / Sidecar B

说明:

  • Istiod → Sidecar:XDS 下发配置(LDS/CDS/RDS/EDS/SDS)

  • Sidecar → Application Pod:拦截 Pod 流量

  • IngressGateway:外部请求入口

  • Service/Endpoint:Kubernetes 服务抽象和 Pod IP

  • 请求直接使用缓存的配置,不每次都触发 XDS


4️⃣ 排查命令大全(严格按组件分类)

4.1 Pod / Deployment

kubectl get pods -n <namespace> -o wide
kubectl describe pod <pod> -n <namespace>
kubectl get deployment -n <namespace>
kubectl get statefulset -n <namespace>
kubectl get job,cronjob -n <namespace>

4.2 Service / Endpoint / VS / DR / Gateway

kubectl get svc,endpoints -n <namespace>
kubectl describe svc <service> -n <namespace>
kubectl describe endpoints <service> -n <namespace>

kubectl get virtualservice -n <namespace>
kubectl describe virtualservice <vs> -n <namespace>

kubectl get destinationrule -n <namespace>
kubectl describe destinationrule <dr> -n <namespace>

kubectl get gateway -n <namespace>
kubectl describe gateway <gw> -n <namespace>

4.3 Sidecar / Envoy

# Stats(连接重置/超时)
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15000/stats | egrep "reset|timeout"

# 配置快照(包括 XDS)
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15000/config_dump

# 路由信息
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15000/routes

# server_info (XDS 连接状态)
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15000/server_info

# 健康状态
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15020/healthz/ready
kubectl exec -it <pod> -c istio-proxy -n <namespace> \
  -- curl -s 127.0.0.1:15020/metrics

4.4 日志排查

# IngressGateway 日志
kubectl logs -n istio-system <ingress-pod> | grep -Ev 'POST|GET'

# Sidecar 日志
kubectl logs <pod> -c istio-proxy -n <namespace> \
  | grep -E "reset|upstream|connection|connection_failure|connection_termination|upstream_reset_before_response_started|upstream_rq_timeout"

# 仅失败事件
kubectl logs <pod> -c istio-proxy -n <namespace> \
  | grep -E "reset|upstream|connection|connection_failure|connection_termination|upstream_reset_before_response_started|upstream_rq_timeout" \
  | grep fail

5️⃣ 排查流程(结合 XDS)

[Client请求]
       |
       v
[IngressGateway] ------------------> 检查日志、Metrics
       |
       v
[Sidecar Envoy Pod] --------------->
       |     |     |
       |     |     +--> stats (reset/timeout)
       |     +--> config_dump / routes (LDS/CDS/RDS/EDS/SDS)
       +--> logs (异常/fail)
       |
       v
[Application Pod] -----------------> 应用日志检查
       |
       v
[Service/Endpoint] ----------------> 检查 Pod IP 是否 ready
       |
       v
[VirtualService/DestinationRule/Gateway] --> 检查流量策略
       |
       v
[Istiod/XDS] ----------------------> 检查 Sidecar 配置是否同步
       |
       v
[故障判定] ------------------------> reset/timeout/fail/配置不一致

注意:

  • XDS 下发只在配置变化或证书更新时触发

  • 常规请求直接使用 Sidecar 缓存配置

  • 流量异常首先从 Sidecar stats/logs 入手,再回溯配置和 Istiod 状态


这个版本严格满足你的要求:

  1. 完整组件全景

  2. 完整 XDS 类型及作用

  3. 明确说明 XDS 不会每次请求下发

  4. ASCII 流量+组件组合图

  5. 完整排查命令表

  6. 流程化排查图(结合 XDS、Sidecar、Gateway、Service、Endpoint)


 

[root@w-qde01v es-ops]# kubectl exec -it qde-app-20220111152812-6954ddb6cf-k5n2q  -c istio-proxy -n qde -- curl -s 127.0.0.1:15000/stats |egrep "
reset|timeout"
cluster.xds-grpc.assignment_timeout_received: 0
cluster.xds-grpc.http2.keepalive_timeout: 0
cluster.xds-grpc.http2.rx_reset: 52
cluster.xds-grpc.http2.tx_flush_timeout: 0
cluster.xds-grpc.http2.tx_reset: 0
cluster.xds-grpc.upstream_cx_connect_timeout: 0
cluster.xds-grpc.upstream_cx_idle_timeout: 0
cluster.xds-grpc.upstream_rq_per_try_timeout: 0
cluster.xds-grpc.upstream_rq_rx_reset: 0
cluster.xds-grpc.upstream_rq_timeout: 0
cluster.xds-grpc.upstream_rq_tx_reset: 0
cluster_manager.cds.init_fetch_timeout: 0
listener_manager.lds.init_fetch_timeout: 0
[root@w-qde01v es-ops]# kubectl logs qde-app-20220111152812-6954ddb6cf-k5n2q  -c istio-proxy -n qde | grep -E "reset|upstream|connection|connecti
on_failure|connection_termination|upstream_reset_before_response_started|upstream_rq_timeout" |awk '{print $7}'|sort -n |uniq -c 
      1 address
      2 for
      4 mode
     22 upstream_reset_before_response_started{connection_failure}
      2 upstream_reset_before_response_started{connection_termination}
      6 upstream_reset_before_response_started{remote_reset}
  14492 via_upstream
     53 XDS
[root@w-qde01v es-ops]#  kubectl logs -n istio-system istio-ingressgateway-55dcd5c99c-zq49g |grep -Ev 'POST|GET'|tail -n 10
[2025-11-04T09:58:01.825Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.1.0:28703 
- -
[2025-11-04T09:58:03.610Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.2.1:39121 
- -
[2025-11-04T09:58:05.378Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.0.0:58424 
- -
[2025-11-04T09:58:07.132Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.0.0:15737 
- -
2025-11-04T10:10:22.689775Z	warning	envoy config	StreamAggregatedResources gRPC config stream closed: 0, 
2025-11-04T10:10:22.829737Z	info	xdsproxy	connected to upstream XDS server: istiod.istio-system.svc:15012
[2025-11-04T10:41:46.067Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.2.1:51115 
- -
[2025-11-04T10:41:47.865Z] "- - HTTP/2" 0 DPE http2.invalid.header.field - "-" 0 0 0 - "-" "-" "-" "-" "-" - - 172.18.2.5:19918 172.18.1.0:38411 
- -
2025-11-04T10:42:04.628681Z	warning	envoy config	StreamAggregatedResources gRPC config stream closed: 0, 
2025-11-04T10:42:04.839267Z	info	xdsproxy	connected to upstream XDS server: istiod.istio-system.svc:15012
[root@w-qde01v es-ops]# 

  

posted on 2025-11-04 10:43  吃草的青蛙  阅读(5)  评论(0)    收藏  举报

导航