diff --git a/iperf2-k8s.sh b/iperf2-k8s.sh
new file mode 100755
index 0000000..2050ff1
--- /dev/null
+++ b/iperf2-k8s.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+set -eu
+
+cd $(dirname $0)
+
+##
+
+kubectl create -f iperf2.yaml
+
+until $(kubectl get pods -l app=iperf2-server -o jsonpath='{.items[0].status.containerStatuses[0].ready}'); do
+ echo "Waiting for iperf server to start..."
+ sleep 5
+done
+
+echo "Server is running"
+echo
+
+CLIENTS=$(kubectl get pods -l app=iperf-client -o name | cut -d'/' -f2)
+
+for POD in ${CLIENTS}; do
+ until $(kubectl get pod "${POD}" -o jsonpath='{.status.containerStatuses[0].ready}'); do
+ echo "Waiting for ${POD} to start..."
+ sleep 5
+ done
+done
+
+echo "All clients are running"
+echo
+
+kubectl get pod -o=custom-columns=NAME:.metadata.name,NODE:.spec.nodeName,IP-NODE:.status.hostIP,IP-POD:status.podIP
+
+echo
+
+##
+##
+
+CLIENTS=$(kubectl get pods -l app=iperf-client -o name | cut -d'/' -f2)
+
+for POD in ${CLIENTS}; do
+ HOST=$(kubectl get pod "${POD}" -o jsonpath='{.status.hostIP}')
+ kubectl exec -it "${POD}" -- iperf -c iperf2-server -T "Client on ${HOST}" "$@"
+ echo
+done
+
+##
+##
+
+kubectl delete --cascade -f iperf2.yaml
+
+##
diff --git a/iperf2.yaml b/iperf2.yaml
new file mode 100644
index 0000000..200dd3c
--- /dev/null
+++ b/iperf2.yaml
@@ -0,0 +1,89 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: iperf2-server-deployment
+ labels:
+ app: iperf2-server
+spec:
+ replicas: 10
+ selector:
+ matchLabels:
+ app: iperf2-server
+ template:
+ metadata:
+ labels:
+ app: iperf2-server
+ spec:
+ affinity:
+ nodeAffinity:
+ preferredDuringSchedulingIgnoredDuringExecution:
+ - weight: 1
+ preference:
+ matchExpressions:
+ - key: kubernetes.io/role
+ operator: In
+ values:
+ - master
+ tolerations:
+ - key: node-role.kubernetes.io/master
+ operator: Exists
+ effect: NoSchedule
+ containers:
+ - name: iperf2-server
+ image: mlabbe/iperf
+ args: ['-s']
+ ports:
+ - containerPort: 5001
+ protocol: TCP
+ name: server-tcp
+ - containerPort: 5001
+ protocol: UDP
+ name: server-udp
+ terminationGracePeriodSeconds: 0
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: iperf2-server
+spec:
+ selector:
+ app: iperf2-server
+ ports:
+ - protocol: TCP
+ port: 5001
+ name: crappy-tcp
+ targetPort: server-tcp
+ - protocol: UDP
+ port: 5001
+ name: crappy-udp
+ targetPort: server-udp
+
+---
+
+apiVersion: apps/v1
+kind: DaemonSet
+metadata:
+ name: iperf2-clients
+ labels:
+ app: iperf2-client
+spec:
+ selector:
+ matchLabels:
+ app: iperf2-client
+ template:
+ metadata:
+ labels:
+ app: iperf2-client
+ spec:
+ tolerations:
+ - key: node-role.kubernetes.io/master
+ operator: Exists
+ effect: NoSchedule
+ containers:
+ - name: iperf2-client
+ image: mlabbe/iperf
+ command: ['/bin/sh', '-c', 'sleep infinity']
+ # To benchmark manually: kubectl exec iperf2-clients-jlfxq -- /bin/sh -c 'iperf -c iperf2-server'
+ terminationGracePeriodSeconds: 0
diff --git a/iperf3.yaml b/iperf3.yaml
index 1a86e42..115303e 100644
--- a/iperf3.yaml
+++ b/iperf3.yaml
@@ -5,7 +5,7 @@ metadata:
labels:
app: iperf3-server
spec:
- replicas: 10
+ replicas: 1
selector:
matchLabels:
app: iperf3-server