mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-20 23:16:49 +00:00
Initial commit
This commit is contained in:
Executable
+184
@@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Starting Network Benchmark Between Nodes..."
|
||||
echo ""
|
||||
|
||||
# Deploy iperf3 server on node-41
|
||||
echo "Deploying iperf3 server on node-41..."
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: iperf3-server
|
||||
namespace: default
|
||||
labels:
|
||||
app: iperf3-server
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: talos-node-41
|
||||
containers:
|
||||
- name: iperf3
|
||||
image: networkstatic/iperf3:latest
|
||||
command: ["iperf3"]
|
||||
args: ["-s"]
|
||||
ports:
|
||||
- containerPort: 5201
|
||||
protocol: TCP
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: iperf3-server
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
app: iperf3-server
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5201
|
||||
targetPort: 5201
|
||||
type: ClusterIP
|
||||
EOF
|
||||
|
||||
echo "Waiting for server to be ready..."
|
||||
kubectl wait --for=condition=ready pod/iperf3-server -n default --timeout=60s
|
||||
sleep 2
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Test 1: node-42 → node-41"
|
||||
echo "=========================================="
|
||||
kubectl run iperf3-client-42 \
|
||||
--image=networkstatic/iperf3:latest \
|
||||
--restart=Never \
|
||||
--rm -i \
|
||||
--overrides='
|
||||
{
|
||||
"spec": {
|
||||
"nodeSelector": {
|
||||
"kubernetes.io/hostname": "talos-node-42"
|
||||
},
|
||||
"securityContext": {
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000,
|
||||
"seccompProfile": {
|
||||
"type": "RuntimeDefault"
|
||||
}
|
||||
},
|
||||
"containers": [{
|
||||
"name": "iperf3-client-42",
|
||||
"image": "networkstatic/iperf3:latest",
|
||||
"stdin": true,
|
||||
"tty": true,
|
||||
"command": ["iperf3", "-c", "iperf3-server", "-t", "10", "-P", "4"],
|
||||
"securityContext": {
|
||||
"allowPrivilegeEscalation": false,
|
||||
"capabilities": {
|
||||
"drop": ["ALL"]
|
||||
},
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000
|
||||
}
|
||||
}]
|
||||
}
|
||||
}' 2>/dev/null || true
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Test 2: node-43 → node-41"
|
||||
echo "=========================================="
|
||||
kubectl run iperf3-client-43 \
|
||||
--image=networkstatic/iperf3:latest \
|
||||
--restart=Never \
|
||||
--rm -i \
|
||||
--overrides='
|
||||
{
|
||||
"spec": {
|
||||
"nodeSelector": {
|
||||
"kubernetes.io/hostname": "talos-node-43"
|
||||
},
|
||||
"securityContext": {
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000,
|
||||
"seccompProfile": {
|
||||
"type": "RuntimeDefault"
|
||||
}
|
||||
},
|
||||
"containers": [{
|
||||
"name": "iperf3-client-43",
|
||||
"image": "networkstatic/iperf3:latest",
|
||||
"stdin": true,
|
||||
"tty": true,
|
||||
"command": ["iperf3", "-c", "iperf3-server", "-t", "10", "-P", "4"],
|
||||
"securityContext": {
|
||||
"allowPrivilegeEscalation": false,
|
||||
"capabilities": {
|
||||
"drop": ["ALL"]
|
||||
},
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000
|
||||
}
|
||||
}]
|
||||
}
|
||||
}' 2>/dev/null || true
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Test 3: node-44 → node-41"
|
||||
echo "=========================================="
|
||||
kubectl run iperf3-client-44 \
|
||||
--image=networkstatic/iperf3:latest \
|
||||
--restart=Never \
|
||||
--rm -i \
|
||||
--overrides='
|
||||
{
|
||||
"spec": {
|
||||
"nodeSelector": {
|
||||
"kubernetes.io/hostname": "talos-node-44"
|
||||
},
|
||||
"securityContext": {
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000,
|
||||
"seccompProfile": {
|
||||
"type": "RuntimeDefault"
|
||||
}
|
||||
},
|
||||
"containers": [{
|
||||
"name": "iperf3-client-44",
|
||||
"image": "networkstatic/iperf3:latest",
|
||||
"stdin": true,
|
||||
"tty": true,
|
||||
"command": ["iperf3", "-c", "iperf3-server", "-t", "10", "-P", "4"],
|
||||
"securityContext": {
|
||||
"allowPrivilegeEscalation": false,
|
||||
"capabilities": {
|
||||
"drop": ["ALL"]
|
||||
},
|
||||
"runAsNonRoot": true,
|
||||
"runAsUser": 1000
|
||||
}
|
||||
}]
|
||||
}
|
||||
}' 2>/dev/null || true
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Cleaning up..."
|
||||
kubectl delete pod iperf3-server -n default
|
||||
kubectl delete service iperf3-server -n default
|
||||
|
||||
echo ""
|
||||
echo "Network benchmark complete!"
|
||||
Reference in New Issue
Block a user