如何测试kubernetes集群网络的性能?

how to test performance of kubernetes cluster network?

我在 aws 中有一个 kubernetes 集群,是用 kops 创建的。我正在尝试评估 kubernetes 集群的网络性能。我正在使用默认的 kubernetes CNI kubenet。

networking:
    kubenet: {}

我已经使用kubernetes-perf-test's net-perf评估了kubernetes集群的网络性能。

我使用下面的命令 运行 测试。

go run ./launch.go --iterations 2

生成的输出

MSS                                          , Maximum, 96, 160, 224, 288, 352, 416, 480, 544, 608, 672, 736, 800, 864, 928, 992, 1056, 1120, 1184, 1248, 1312, 1376, 1440,
1 iperf TCP. Same VM using Pod IP            ,36736.000000,2101,25486,36736,35636,36115,35631,6801,6544,7146,6565,6320,7252,6363,5707,5855,6034,36058,34098,36713,35625,34571,6341,
2 iperf TCP. Same VM using Virtual IP        ,30203.000000,5531,6072,5963,5294,6047,5879,5412,5456,5844,28499,29306,29289,30203,28516,5987,5460,5833,6029,4920,5027,5111,4700,
3 iperf TCP. Remote VM using Pod IP          ,664.000000,0,0,102,134,156,196,229,255,266,189,214,240,235,267,314,294,403,531,612,617,664,657,
4 iperf TCP. Remote VM using Virtual IP      ,778.000000,0,0,134,163,202,240,287,313,338,414,481,477,512,610,605,559,604,578,572,679,778,697,
5 iperf TCP. Hairpin Pod to own Virtual IP   ,29522.000000,974,547,19748,22219,24301,24043,25328,24531,4508,4471,5699,4339,4199,5001,5504,4974,15043,28658,29522,28902,28574,28956,
6 iperf UDP. Same VM using Pod IP            ,1592.000000,1592,
7 iperf UDP. Same VM using Virtual IP        ,1008.000000,1008,
8 iperf UDP. Remote VM using Pod IP          ,0.000000,0,
9 iperf UDP. Remote VM using Virtual IP      ,0.000000,0,
10 netperf. Same VM using Pod IP             ,3516.740000,3516.74,
11 netperf. Same VM using Virtual IP         ,0.000000,0.00,
12 netperf. Remote VM using Pod IP           ,422.430000,422.43,
13 netperf. Remote VM using Virtual IP       ,0.000000,0.00,

我不确定这个输出的实际含义。我如何使用此值确定我的 k8s 集群的网络是否正常运行?

此外,我尝试绘制此数据。

此脚本正在 TCP、UDP 和 NetPerf 的 5 种情况下测试 iperf/netperf MSS 测试点中的传输速度。

老实说,您在提供的 Github 链接中描述的所有内容。

Iperf 是一种常用的网络测试工具,可以创建 TCP/UDP 数据流并测量承载它们的网络的吞吐量。它允许用户设置各种参数,这些参数可用于测试网络,或者用于优化或调整网络。

Netperf 也是另一个很好的网络测试工具,PerfKitBenchmark 套件也使用它来测试性能并相互对各种云提供商进行基准测试。

您可以找到更多信息here

在 Github 上,您有 2x5 个用于 TCP 和 UPD 的 ipetf 场景和 5 个用于 netperf 的场景。

The 5 major network traffic paths are combination of Pod IP vs Virtual IP and whether the pods are co-located on the same node/VM versus a remotely located pod.
- Same VM using Pod IP

Same VM Pod to Pod traffic tests from Worker 1 to Worker 2 using its Pod IP.
- Same VM using Cluster/Virtual IP

Same VM Pod to Pod traffic tests from Worker 1 to Worker 2 using its Service IP (also known as its Cluster IP or Virtual IP).
- Remote VM using Pod IP

Worker 3 to Worker 2 traffic tests using Worker 2 Pod IP.
- Remote VM using Cluster/Virtual IP

Worker 3 to Worker 2 traffic tests using Worker 2 Cluster/Virtual IP.
- Same VM Pod Hairpin to itself using Cluster IP

关于 CSV 输出

MMS - 最大段大小。有关它的更多信息,请参见 here.

Example TCP MMS The TCP protocol includes a mechanism for both ends of a connection to negotiate the maximum segment size (MSS) to be used over the connection. Each end uses the OPTIONS field in the TCP header to advertise a proposed MSS. The MSS that is chosen is the smaller of the values provided by the two ends.

The purpose of this negotiation is to avoid the delays and throughput reductions caused by fragmentation of the packets when they pass through routers or gateways and reassembly at the destination host.

The value of MSS advertised by the TCP software during connection setup depends on whether the other end is a local system on the same physical network (that is, the systems have the same network number) or whether it is on a different (remote) network.

因此对于每个场景(最大段大小),对于协议,脚本正在测量 Mbit/sec 中每个 MSS 数据点的传输速度。如果您将其粘贴到 excel 并使用 "Text to Columns" 除以逗号,此输出将具有更好的可见性。

图表中有相同的值,只是为了更好的可见性。