I was configuring recently Calico on a RKE2 cluster. I wanted to test the network performance of the CNI and check, if it can achieve the 100Gbps bandwidth of the NIC.

iperf3 is a great tool for this, but unfortunately, it is single threaded and the test was CPU bound.

To overcome this, I wrote a simple script, which runs multiple iperf3 tests on a Kubernetes cluster. The tool is available on my Github.

You have to provide the node for the iperf3 servers and clients and the number of parallel tests. The scripts then starts iperf3 servers, gets their pod IPs and starts a client for each server. At the end of the test, it sums the bitrate of all the tests.

The results might be a bit off, as the client pods might not start and end at the same time. That’s why the scripts discards the first and last 15 seconds of measurements.

When I compared the results from the script to the numbers in nload vxlan.calico they were pretty close.

❯ go run ./cmd/k8siperf3 --parallel-count 8 \
	--client-node-name node-1 --server-node-name node-2
2023/07/13 11:35:40 Creating 8 iperf3 server pods
2023/07/13 11:35:41 Waiting for iperf3 server pods to start
2023/07/13 11:35:45 iperf3 server pod 0 IP address: 10.42.113.216
2023/07/13 11:35:45 iperf3 server pod 1 IP address: 10.42.113.218
2023/07/13 11:35:46 iperf3 server pod 2 IP address: 10.42.113.211
2023/07/13 11:35:46 iperf3 server pod 3 IP address: 10.42.113.212
2023/07/13 11:35:47 iperf3 server pod 4 IP address: 10.42.113.213
2023/07/13 11:35:47 iperf3 server pod 5 IP address: 10.42.113.214
2023/07/13 11:35:47 iperf3 server pod 6 IP address: 10.42.113.195
2023/07/13 11:35:47 iperf3 server pod 7 IP address: 10.42.113.196
2023/07/13 11:35:47 Creating 8 iperf3 client pods
2023/07/13 11:35:47 Waiting for iperf3 client pods to finish
2023/07/13 11:36:53 iperf3 client pod 0 finished
2023/07/13 11:36:53 iperf3 client pod 1 finished
2023/07/13 11:36:53 iperf3 client pod 2 finished
2023/07/13 11:36:54 iperf3 client pod 3 finished
2023/07/13 11:36:54 iperf3 client pod 4 finished
2023/07/13 11:36:55 iperf3 client pod 5 finished
2023/07/13 11:36:55 iperf3 client pod 6 finished
2023/07/13 11:36:55 iperf3 client pod 7 finished
Bitrate: 86.589250 Gbits/sec