Avisi cloud logo
Networking

Network Performance testing in Kubernetes

Running network performance tests in Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: iperf3-server-deployment
  labels:
    app: iperf3-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: iperf3-server
  template:
    metadata:
      labels:
        app: iperf3-server
    spec:
      hostNetwork: true
      nodeSelector:
        kubernetes.io/hostname: mynode01
      containers:
        - name: iperf3-server
          image: networkstatic/iperf3
          args: ["-s"]
          ports:
            - containerPort: 5201
              name: server
      terminationGracePeriodSeconds: 0
 
---
apiVersion: v1
kind: Service
metadata:
  name: iperf3-server
spec:
  selector:
    app: iperf3-server
  ports:
    - protocol: TCP
      port: 5201
      targetPort: server
 
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: iperf3-clients
  labels:
    app: iperf3-client
spec:
  selector:
    matchLabels:
      app: iperf3-client
  template:
    metadata:
      labels:
        app: iperf3-client
    spec:
      hostNetwork: true
      nodeSelector:
        kubernetes.io/hostname: mynode02
      containers:
        - name: iperf3-client
          image: networkstatic/iperf3
          command: ["/bin/sh", "-c", "sleep infinity"]
          resources: {}
      terminationGracePeriodSeconds: 0

Example output:

Connecting to host 10.170.11.3, port 5201
[  5] local 10.170.13.7 port 38146 connected to 10.170.11.3 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   312 MBytes  2.61 Gbits/sec   48    660 KBytes
[  5]   1.00-2.00   sec   189 MBytes  1.58 Gbits/sec  111    385 KBytes
[  5]   2.00-3.00   sec   238 MBytes  1.99 Gbits/sec    2    432 KBytes
[  5]   3.00-4.00   sec   195 MBytes  1.64 Gbits/sec   41    429 KBytes
[  5]   4.00-5.00   sec   249 MBytes  2.09 Gbits/sec   15    471 KBytes
[  5]   5.00-6.00   sec   286 MBytes  2.40 Gbits/sec    4    686 KBytes
[  5]   6.00-7.00   sec   276 MBytes  2.32 Gbits/sec   59    324 KBytes
[  5]   7.00-8.00   sec   149 MBytes  1.25 Gbits/sec   20    389 KBytes
[  5]   8.00-9.00   sec   230 MBytes  1.93 Gbits/sec    9    459 KBytes
[  5]   9.00-10.00  sec   168 MBytes  1.41 Gbits/sec  150    268 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  2.24 GBytes  1.92 Gbits/sec  459             sender
[  5]   0.00-10.00  sec  2.23 GBytes  1.92 Gbits/sec                  receiver
 
iperf Done.

Last updated on