<section id="nice" data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="word-spacing: 0px; word-break: break-word; word-wrap: break-word; font-size: 16px; line-height: 1.75em; letter-spacing: 0.5px; text-align: justify; color: #3f3f3f; padding: 0 8px 0 8px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif !important;"><p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">随着分布式服务架构的流行,特别是微服务等设计理念在现代应用普及开来,应用中的服务变得越来越分散,因此服务之间的通信变得越来越依赖网络,很有必要来谈谈实现微服务可观测性中越来越重要的一环——云原生网络的可观测。K8s 是微服务设计理念能落地的最重要的承载体,本文主要聚焦谈谈 K8s 的网络可观测性,以及其给基础设施/应用等团队能带来的价值。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">谈 K8s 网络可观测性之前,先简单了解下 K8s 的网络通信是如何实现的,CNCF 定义了容器网络接口即 CNI,CNI 提供了一种应用容器的插件化网络解决方案,定义对网络容器进行操作和配置的规范,通过插件的形式对 CNI 接口进行实现。实现了 CNI 接口则成为 CNI 插件,常见的 CNI 插件包括 Calico、Cilium、Flannel、Kube-OVN、Terway、Weave Net 等,每种 CNI 插件都有自己的偏重性,使用者可用根据环境限制、功能需求和性能需求等各种方面选择自己所需的 CNI 插件。</p> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="display: block; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.05); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-top: 20px; margin: 0; padding: 25px 20px; border: 4px solid #1d51ce; font-size: 14px; background-color: #ffffff; margin-bottom: 27px;"> <p style="padding-top: 8px; padding-bottom: 8px; padding: 0; margin-bottom: 27px; margin: 0px; font-size: 14px; color: #3f3f3f; line-height: 1.6em;">但是目前针对这种类繁多的 CNI 插件并没有统一的网络可观测手段,对 K8s 网络问题的排障定位的前提是需要学习这众多 CNI 插件的原理,对于 K8s 运维或者微服务开发同学们来说学习成本高,而这么高的学习成本学成之后也只能用来回答「网络是不是瘫痪了」这类二极管问题,孤立的看网络只能看到一个个虚拟网口、虚拟网桥、网络策略,但看不到其中流动的每一个访问路径,每一次应用调用,因此也就无法回答关于访问路径、应用调用等这类细粒度的问题。</p> </blockquote> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">目前已经开始有一些 CNI 插件厂商在支持 K8s 网络可观测性了,例如 Cilium 单独起了一个子项目 Hubble 来做分布式网络和安全的可观测性,目前已知的如 Calico,Kube-OVN 等也开始推进网络可观测性能力了;也有纯第三方厂商在做 K8s 网络可观测性,DeepFlow 就实现了一种与 CNI 插件无关的网络可观测性能力。下面将重点介绍下 Hubble 和 DeepFlow 两个组件,看看目前 K8s 网络可观测性的能力。</p> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">01</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">Hubble</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">Hubble 是一个用于云原生工作负载分布式的 K8s 网络和安全观测平台,它构建在 Cilium 和 eBPF 之上,能观测服务的通信行为,也观测网络基础设施的通信行为。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">Hubble 的组件架构图,包含 CLI/Server/Metrics/Relay/UI,其中 Server 负责采集网络可观测性数据;Relay 对外提供统一的 API 入口,提供集群可观测能力;CLI 是一个命令行工具;Metrics 负责将指标数据输出给 Prometheus,因此可以在 Grafana 构建 Hubble 指标数据的 Dashboard;UI 这是目前还在 Beta 中,主要展示服务依赖/通信拓扑</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002dc64ff4.jpg" alt="架构图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">架构图</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">在部署 Cilium 时,需要手动开启 Hubble,根据自身所需数据,按需设置 Hubble 配置</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">helm install cilium cilium/cilium \<br>--version 1.13.0 \<br>--namespace kube-system \ <br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> prometheus.enabled=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> \ <br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> operator.prometheus.enabled=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> \ <br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> hubble.enabled=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> \<br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> hubble.ui.enabled=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> \<br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> hubble.relay.enabled=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> \ <br>--<span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">set</span> hubble.metrics.enableOpenMetrics=<span class="hljs-literal" style="color: #56b6c2; line-height: 26px;">true</span> -f cilium.yaml<br></code></pre> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">以下是 Hubble 提供的主要能力,结合 UI 页面与 Grafana 提供的 Dashboard 来展示</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">服务依赖/通信拓扑</strong>,以服务的维度查看通信拓扑</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002ddadae4.jpg" alt="服务依赖/通信拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">服务依赖/通信拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">网络监控/告警</strong>,包含网络协议/端口/丢包等指标、流日志详情</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002df300fd.jpg" alt="网络监控/告警" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">网络监控/告警</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">应用监控</strong>,包含 HTTP / DNS 的 RED 指标及调用日志详情</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002df93267.jpg" alt="应用监控" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">应用监控</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">安全可观测性</strong>,结合网络安全策略与流量,观测流量通过情况</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002dadd62e.jpg" alt="安全可观测性" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">安全可观测性</figcaption></figure> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">02</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">DeepFlow</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">DeepFlow 是一个高度自动化的可观测性平台,基于 AF_PACKET、BPF、eBPF、WASM 等技术,无需依赖 CNI 插件,既能观测 K8s 网络的通信行为进行观测、也能让构建在 K8s 上的云原生应用的无需埋点插码就能具备可观测性。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">DeepFlow 由 Agent 和 Server 两个进程组成。每个 K8s 容器节点、虚拟机或物理裸机中运行一个 Agent,负责该服务器上所有应用进程的 AutoMetrics 和 AutoTracing 数据采集。Server 运行在一个 K8s 集群中,提供 Agent 管理、数据标签注入、数据写入、数据查询服务。</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/2023031664127568375d0.jpg" alt="架构图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">架构图</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">DeepFlow 可以做到 CNI 插件和应用都无感知情况下,一条命令五分钟就能让 K8s 网络和云原生应用的具备可观测性</p> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; color: #376bb4; background-color: #f3f3f3; padding-top: 15px; background: #282c34; border-radius: 5px;">helm upgrade deepflow-agent -n deepflow deepflow/deepflow-agent -f values-custom.yaml<br></code></pre> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><br>DeepFlow 产品可视化,有 UI 界面 和 Grafana Dashboard 两种形式,以下产品功能主要基于 UI 界面形式</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">全景调用拓扑</strong>,包含服务依赖拓扑以及覆盖网络各个节点的网络路径拓扑</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002d7af98c.jpg" alt="服务拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">服务拓扑</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002dd1afbf.jpg" alt="网络路径拓扑" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">网络路径拓扑</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">全链路分布式拓扑</strong>,面向用户请求的零侵扰分布式追踪,可从代码追踪到系统进程并进一步追踪到网络节点</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002d6cd15e.jpg" alt="调用链追踪" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">调用链追踪</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">网络监控</strong>,包含覆盖三四层负载、时延、异常、性能等网络指标、分钟粒度的流日志及包粒度的时序图</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002e138460.jpg" alt="网络指标" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">网络指标</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002e01a350.jpg" alt="流日志" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">流日志</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/2023031664127568c9c4d.jpg" alt="时序图" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">时序图</figcaption></figure> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;"><strong style="font-weight: bold; color: #4e6cb4;">应用监控</strong>,包含HTTP(S)、Dubbo、gRPC、ProtobufRPC、SOFARPC、MySQL、PostgreSQL、Redis、Kafka、MQTT、DNS等协议的 RED 指标及调用日志</p> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002d8cdd06.jpg" alt="应用指标" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">应用指标</figcaption></figure> <figure data-tool="mdnice编辑器" style="margin-top: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 0; padding: 0; margin-bottom: 27px;"><img src="https://yunshan-guangzhou.oss-cn-beijing.aliyuncs.com/pub/pic/20230314641002db7defc.jpg" alt="调用日志" style="display: block; margin: 0 auto; max-width: 100%;"><figcaption style="margin-top: 5px; text-align: center; color: #888; font-size: 14px;">调用日志</figcaption></figure> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">03</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">总结</span><span class="suffix"></span></h1> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">通过分析 Hubble 和 DeepFlow 两款产品,虽然是不同厂商在做,但是对于 K8s 网络可观测性的功能点上其实是有一样的认知,笔者基于两个产品能力以及业界对可观测性数据的定义,总结了 K8s 网络可观测性应该具备的能力如下:</p> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">全景展示:服务依赖拓扑</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">指标数据:应用指标/网络指标</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">日志数据:应用调用日志/网络流日志/网络时序图</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">追踪数据:应用调用链追踪/网络路径追踪</section></li></ul> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; padding: 0; font-size: 16px; line-height: 1.6em; margin-bottom: 27px; color: #3f3f3f;">为了方便大家更好的了解在 K8s 网络可观测性上 Hubble 和 DeepFlow 平台的差异,总结表格如下:</p> <section class="table-container" data-tool="mdnice编辑器" style="margin: 0; padding: 0; overflow-x: auto;"><table style="display: table; text-align: left;"> <thead> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">软件架构</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">Hubble</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">DeepFlow</th> </tr> </thead> <tbody style="border: 0;"> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">CNI依赖</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">完全依赖 Cilium</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">无</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">eBPF依赖</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">完全依赖 eBPF</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">仅 AutoTracing、SSL 解密依赖</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">后端存储</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">使用 Prometheus 存储指标数据,不存储拓扑和日志数据</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">基于 ClickHouse 有完整的存储解决方案</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">数据标签</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">不支持自定义标签、开销大</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">支持 K8s 资源/K8s label 标签、开销低</td> </tr> </tbody> </table> </section><section class="table-container" data-tool="mdnice编辑器" style="margin: 0; padding: 0; overflow-x: auto;"><table style="display: table; text-align: left;"> <thead> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">产品能力</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">Hubble</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">DeepFlow</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #f0f0f0; min-width: 85px;">说明</th> </tr> </thead> <tbody style="border: 0;"> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">服务拓扑</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">Hubble 仅支持 service 维度;DeepFlow 可支持按任意 Tag 聚合为拓扑</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">应用指标</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">Hubble 支持 HTTP/DNS/Kafka协议;DeepFlow 支持十余种协议,且正在支持 WASM 插件解析私有协议</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">应用调用日志</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><mark style="color: #376bb4; background-color: #f3f3f3;">无</mark></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">查看详细的调用信息</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">应用调用链追踪</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><mark style="color: #376bb4; background-color: #f3f3f3;">无</mark></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有(仅企业版)</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">更好的和应用结合,快速确定问题发生在应用、系统还是网络</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">网络指标</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">Hubble 只有流量/包量统计;DeepFlow 指标量更丰富,还涉及时延、异常、性能的指标</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">网络路径拓扑</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><mark style="color: #376bb4; background-color: #f3f3f3;">无</mark></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">可快速知道问题发生的网络位置</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">网络流日志</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">Hubble 可根据网络安全策略标记流是否丢弃;DeepFlow 可给流增加更多的标签和指标</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">网络时序图</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><mark style="color: #376bb4; background-color: #f3f3f3;">无</mark></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有(仅企业版)</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">可更加深入分析包的交互</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">网络安全</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">有</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><mark style="color: #376bb4; background-color: #f3f3f3;">无</mark></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">Hubble 可根据网络安全策略标记流是否丢弃</td> </tr> </tbody> </table> </section><h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 34px; color: #1d51ce; margin-bottom: 0; margin-top: calc(2 * 27px);"><span class="prefix" style="display: none;"></span><span class="content">04</span><span class="suffix"></span></h1> <h1 data-tool="mdnice编辑器" style="font-weight: bold; margin: 0; padding: 0; font-size: 18px; margin-top: 5px; margin-bottom: 32px; color: #1d51ce;"><span class="prefix" style="display: none;"></span><span class="content">参考文档</span><span class="suffix"></span></h1> <ul data-tool="mdnice编辑器" style="margin-top: 8px; padding-left: 25px; list-style-type: disc; color: #1d51ce; margin: 0; margin-bottom: 27px;"> <li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">https://github.com/cilium/hubble</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">https://docs.cilium.io/en/stable/overview/intro/</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">https://github.com/deepflowio/deepflow</section></li><li><section style="padding: 0; margin-top: 5px; margin-bottom: 5px; text-align: left; font-weight: 500; color: #3f3f3f; line-height: 1.6em; margin: 0;">https://deepflow.io/docs/zh/about/overview/</section></li></ul> </section>