The Simplest Way to Make k6 and Ubiquiti Work Like They Should
Teams use k6 and ubiquiti to test how network hardware handles heavy traffic loads. In this workflow, k6 sends synthetic traffic while Ubiquiti gear routes and measures the packets. This setup helps engineers find network bottlenecks before real users hit a slow app. You can test firewall rules, switch capacity, and routing limits under real load. Good tests show where packets drop or slow down across your office or data center. How k6 and ubiquiti handle logins and data flow When you run a
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use k6 and ubiquiti to test how network hardware handles heavy traffic loads. In this workflow, k6 sends synthetic traffic while Ubiquiti gear routes and measures the packets.
This setup helps engineers find network bottlenecks before real users hit a slow app. You can test firewall rules, switch capacity, and routing limits under real load. Good tests show where packets drop or slow down across your office or data center.
How k6 and ubiquiti handle logins and data flow
When you run a test, k6 acts as the traffic generator. It spins up virtual users that send requests across your local or remote network. Ubiquiti routers and switches sit in the middle and direct this traffic to your apps.
To measure the results, engineers often query the Ubiquiti controller API during a test run. The k6 runner or a side script logs in to the Ubiquiti controller. It reads device metrics like CPU load, memory use, and port throughput.
Data flows in two clear paths during these tests. First, test traffic moves from k6 nodes through Ubiquiti ports to the target app. Second, health metrics flow from the Ubiquiti controller back to your monitoring dashboard. Tying both streams together shows how traffic spikes hurt your hardware.
Common failure modes and how to scope network paths
Many teams make mistakes when they link load tools to network controllers. The biggest risk is using a shared admin account for the Ubiquiti API. If a test script holds full admin keys, a bug can change live firewall rules. A leaked key in a shared repo also puts the whole network at risk.
Broad network tokens create a second problem for engineering teams. When everyone uses the same login, audit logs cannot show who ran which test. Unlogged queries make it hard to see if a spike came from a test or an attack.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
You can fix this by creating a read-only role for your test scripts. Give each engineer or test runner a separate login with minimal rights. The script only needs to read port stats, not write new routing rules.
You also need to scope the network paths between k6 and your hardware. Place your k6 runners on a dedicated test VLAN inside your Ubiquiti setup. Set clear firewall rules so test traffic only reaches staging apps, never production databases. Watch your state tables too, since fast load tests can fill up router memory fast.
Best ways to run safe network load tests
Start every test with a small number of virtual users. Watch your Ubiquiti controller metrics to see how switches handle the initial flow. Step up the load in small blocks so you do not crash core routers.
Always tag your test traffic with clear headers or source IP ranges. This helps your team filter out test runs from real customer logs. When the test ends, shut down the runner nodes and revoke any temporary API keys. Check your switch logs right away to confirm all ports returned to normal levels.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Can k6 test Ubiquiti routers directly?
Yes, k6 sends traffic through Ubiquiti routers to test throughput and firewall rules. You can also query the controller API to check device health during the run.
Why do Ubiquiti firewalls drop k6 traffic during load tests?
High connection rates from k6 can trigger threat management rules or fill state tables. Run tests from an allowlisted VLAN and tune state timeouts for your test subnet.
What role should k6 scripts use on a Ubiquiti controller?
Always give your scripts a read-only role on the controller. This lets the tool read port stats without risking changes to live network rules.
Related guides
In this post