Skip to content

Commit 8d2ab31

Browse files
Merge pull request #79 from aojea/kubedocs
docs: explain how to use neper in Kubernetes
2 parents a6ab169 + 5251f91 commit 8d2ab31

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,69 @@ be insignificant. However, the keys are case sensitive.
422422
throughput_units
423423
throughput
424424

425+
## Running in Kubernetes
426+
427+
When running `neper` in Kubernetes for network performance testing, it is important to ensure that the client and server pods are running on different nodes. This provides a more realistic network path and avoids the test being skewed by the node's internal loopback traffic.
428+
429+
For quick, ad-hoc tests, you can use `kubectl run` to launch the server and client pods directly, using a `nodeSelector` to force them onto specific nodes.
430+
For more permanent or complex testing scenarios, it is recommended to use more advanced Kubernetes capabilities by using `Deployments` and `Services`.
431+
432+
### Identify Your Nodes
433+
434+
First, list the nodes in your cluster to choose where to place the server and client pods.
435+
436+
kubectl get nodes
437+
438+
You will see an output with your node names, like `node-1` and `node-2`.
439+
440+
### Launch the neper Server
441+
442+
Launch the server pod on one of your nodes (e.g., node-1). The --overrides flag is used here to inject the nodeSelector into the pod specification.
443+
444+
kubectl run neper-server --image=ghcr.io/google/neper:stable \
445+
--command \
446+
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": { "kubernetes.io/hostname": "node-1" }}}' \
447+
-- tcp_rr
448+
449+
### Launch the neper Client
450+
451+
Next, get the IP address of the server pod you just created.
452+
453+
SERVER_IP=$(kubectl get pod neper-server -o jsonpath='{.status.podIP}')
454+
455+
Now, launch the client pod on a different node (e.g., node-2), and pass the server's IP address to it using the -H flag.
456+
457+
kubectl run neper-client --image=ghcr.io/google/neper:stable \
458+
--command \
459+
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": { "kubernetes.io/hostname": "node-2" }}}' \
460+
-- tcp_rr -c -H $SERVER_IP
461+
462+
### View the Results
463+
464+
The Pods will run the tests and finish once they are completed:
465+
466+
kubectl get pods
467+
NAME READY STATUS RESTARTS AGE
468+
neper-client 0/1 Completed 1 (18s ago) 31s
469+
neper-server 0/1 Completed 1 (18s ago) 2m37s
470+
471+
You can now tail the logs of the client pod to see the performance test results in real-time. The client pod will automatically exit when the test is complete.
472+
473+
kubectl logs -f neper-client
474+
475+
### Interacting with the Pods
476+
477+
You can also open an interactive shell for more exploratory or advanced testing. For example, to get a shell into a client pod:
478+
479+
kubectl run -it neper-client --image=ghcr.io/google/neper:stable \
480+
--command \
481+
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": { "kubernetes.io/hostname": "node-2" }}}' \
482+
-- sh
483+
484+
When you are finished, you can delete the pods:
485+
486+
kubectl delete pod neper-server neper-client
487+
425488
## Contribution guidelines
426489

427490
* C99, avoid compiler-specific extensions.

0 commit comments

Comments
 (0)