Kubernetes Network Speed Test Between 2 Pods
Bandwidth Test between Pods

Kubernetes Network Speed Test Between 2 Pods

In Kubernetes knowing network speed between pods is important for many reasons but here are the top 3 reasons in my opinion.

  1. Performance monitoring.
  2. Troubleshooting network issues.
  3. Verifying network plugin configuration.


QUICK HELP: If you resonate with my work, please consider joining me on Youtube and Substack. I totally appreciate your support. Thank You.


Ok, let's continue.

How can you do network speed test?

Iperf is an open-source tool to measure network performance. In Kubernetes, we can use iperf in 2 pods and simulate network traffic between pods and measure it.

Check this out. This is what we are going to do now.

We will have 2 pods setup on 2 different nodes. We will use iperf to test the network bandwidth between the pods. Use the following config to setup the server.yaml

Pod-1 in the diagram is represented as "iperf-server"

apiVersion: v1
kind: Pod
metadata:
  name: iperf-server
spec:
  containers:
    - name: iperf
      image: cagedata/iperf3
      command: ["iperf3", "-s"]
      ports:
        - containerPort: 5201         

Run the following command to setup the server.

kubectl apply -f server.yaml

Now, lets setup the client.yaml

Pod-3 in the diagram is represented as iperf-client. Make sure both the pods are running on 2 different worker nodes.

apiVersion: v1
kind: Pod
metadata:
  name: iperf-client
spec:
  containers:
    - name: iperf
      image: cagedata/iperf3
      command: ["sleep", "30000"]        

Run the client using following command.

kubectl apply -f client.yaml

Now, to run the test, we would require iperf-server pod ip. So run the following command to find it and save it.

kubectl get pods -o wide | grep iperf-server

Now, let's connect to the client server and run the iperf test. The following command will connect you to client pod.

kubectl exec -it iperf-client -- bash

Run the following command to test the network speed test. Replace the iperf server pod ip with the server pod ip you saved before.

iperf3 -c 10.244.2.2 -p 5201

That's it. You should see something like this. I am running this on my KinD multi node cluster. So network speed is quite high. I can see a throughput of nearly 9 Gbytes/sec.

iperf test to check network speed.

That's it for today. If this is useful, do a repost, it really helps. Thank you.

If you have any questions, don't forget to ask.

D. Geeth Dulanjana

Associate DevOps Engineer at Efutures | 1X AWS | 1X AZURE | DevOps | Terraform | Docker | Kubernetes | Cloud | BSc (Hons) in Computer Systems Engineering | SLIIT

7 个月

Helpful!

Meenakshi A.

Technologist & Believer in Systems for People and People for Systems

7 个月

Thanks for the simplified walkthrough for the good ??

Mutha Nagavamsi

Kubernetes, Devops, Cloud & Tech. I run a supercool k8s community, do join. 75K+ strong all socials ??

7 个月

Did you face any network issues on k8s before? How did you find and fix? What tools helped you the most?

要查看或添加评论,请登录

社区洞察

其他会员也浏览了