Testing Connectivity Between Kubernetes Pods with Iperf3

This document (000020954) is provided subject to the disclaimer at the end of this document.

Situation

In this article, we will show you how to use iperf3 to test the connectivity between Kubernetes pods in your cluster. We will use a Deployment to ensure that iperf3 pods are running on each node in the cluster.

Prerequisites

  • A running Kubernetes cluster
  • The kubectl command-line tool installed on your local machine

Step 1: Deploy Iperf3 as a Deployment

To deploy iperf3 as a Deployment on your Kubernetes cluster, you will need to create a YAML file with the following contents:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: iperf3-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: iperf3
  template:
    metadata:
      labels:
        app: iperf3
    spec:
      containers:
      - name: iperf3
        image: leodotcloud/swiss-army-knife
        ports:
        - containerPort: 5201

 

This YAML file creates a Deployment named iperf3-deployment with 3 replicas of the iperf3 container.

You can then create the Deployment by running the following command:

kubectl apply -f iperf3-deployment.yaml


Step 2: Verify the Deployment

Once the Deployment is up and running, you can use the following command to check that iperf3 pods are running on all nodes in the cluster:

kubectl get pods

You should see output similar to the following:

NAME                             READY   STATUS    RESTARTS   AGE
iperf3-deployment-5b7f6f5c8-5wcw5   1/1     Running   0          36s
iperf3-deployment-5b7f6f5c8-6q4q4   1/1     Running   0          36s
iperf3-deployment-5b7f6f5c8-8wnw7   1/1     Running   0          36s

 

Step 3: Test Connectivity Between Pods

To test the connectivity between pods, you will need to use the pod's IP addresses. You can use the following command to get the IP addresses of the pods:

kubectl get pods -o wide
 

You should see output similar to the following:

NAME                             READY   STATUS    RESTARTS   AGE    IP            NODE
iperf3-deployment-5b7f6f5c8-5wcw5   1/1     Running   0          36s   10.1.0.1      node1
iperf3-deployment-5b7f6f5c8-6q4q4   1/1     Running   0          36s   10.1.0.2      node2
iperf3-deployment-5b7f6f5c8-8wnw7   1/1     Running   0          36s   10.1.0.3      node3


Once you have the IP addresses of the pods you want to test, you can use the iperf3 command to test the connectivity. (Make sure to choose pods running on different nodes)

First, choose a pod to run in server mode:

kubectl exec -it <pod-name> -- iperf3 -s -p 12345


Second, choose a pod to run in client mode:

kubectl exec -it <pod-name> -- iperf3 -c <server pod IP address> -p 12345


The iperf3 command will output the network performance statistics, including the bandwidth, packet loss, and jitter.

This is an example output from a test cluster; please note that due to the various layers of networking involved, there is a performance impact that is expected:

Connecting to host 10.42.0.36, port 12345
[  4] local 10.42.0.37 port 45568 connected to 10.42.0.36 port 12345
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  2.23 GBytes  19.1 Gbits/sec  300   2.88 MBytes       
[  4]   1.00-2.00   sec  2.49 GBytes  21.4 Gbits/sec  737   1.58 MBytes       
[  4]   2.00-3.00   sec  2.42 GBytes  20.8 Gbits/sec  524   2.33 MBytes       
[  4]   3.00-4.00   sec  2.17 GBytes  18.6 Gbits/sec  248   2.41 MBytes       
[  4]   4.00-5.00   sec  2.25 GBytes  19.3 Gbits/sec  151   2.45 MBytes       
[  4]   5.00-6.00   sec  2.36 GBytes  20.2 Gbits/sec   73   3.00 MBytes       
[  4]   6.00-7.00   sec  2.40 GBytes  20.6 Gbits/sec  181   2.84 MBytes       
[  4]   7.00-8.00   sec  2.29 GBytes  19.7 Gbits/sec   73   2.64 MBytes       
[  4]   8.00-9.00   sec  2.35 GBytes  20.2 Gbits/sec  110   2.44 MBytes       
[  4]   9.00-10.00  sec  2.27 GBytes  19.5 Gbits/sec  167   2.43 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  23.2 GBytes  19.9 Gbits/sec  2564             sender
[  4]   0.00-10.00  sec  23.2 GBytes  19.9 Gbits/sec                  receiver


 

Conclusion

In this article, we have shown you how to use iperf3 to test connectivity between Kubernetes pods in your cluster. We have used a Deployment to ensure that iperf3 pods are running on each node in the cluster. We hope that this article has helped demonstrate how to use iperf3 for testing connectivity between pods in your Kubernetes cluster.


 

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020954
  • Creation Date: 24-Jan-2023
  • Modified Date:24-Jan-2023
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center