A UDP/TCP traffic generator for testing Kubernetes Network Policies. Runs in two modes: service mode (listeners) and client mode (traffic generation). Deploy listener pods across a cluster as a DaemonSet, then issue traffic commands from any pod to verify that network policies permit or block the expected traffic.
./generator Start Udp_port=15000 Tcp_port=16000
Starts both a UDP listener and a TCP (HTTP) echo server.
./generator Do Udp_port=15000 Destination=10.0.0.5 Port=16000 Quantity=1000
Arguments: Udp_port (local service port), Tcp_port (if set, use TCP instead of UDP), Destination (target IP), Port (target port), Quantity (packet count), Timeout (seconds, auto-calculated if 0).
Results are reported as: Total UDP Sent:1000 OK:1000 Err:0 Timeout:false Took:2 seconds
Apply k8s/deploy.yaml to deploy into namespace traffic-01:
From any pod, test connectivity to the traffic service. If the NetworkPolicy allows traffic, all packets succeed. If blocked, all packets error with a timeout.
Messages use a pipe-delimited format: id|action|dest|port|qty|text|timeout. Actions include sendUdp, sendTcp, request, and response.
Cross-compiles for linux/amd64. Image: registry.layer-8.dev:44443/traffic/traffic-generator:latest. Run with environment variables CMD=Start, Udp_port, and Tcp_port.