Kubernetes

Ops integrations

Take the distributed fleet to Kubernetes: manifests for the controller, agents and a run Job, plus a Dockerfile — scale load generation with your cluster.

Browse all 52 demos 12 categories
Run it
$ loadr run examples/k8s/run-job.yaml
examples/k8s/run-job.yaml
# Submit a run to the controller; the load fans out across all agent pods.
# The plan is mounted from a ConfigMap so you can edit it without rebuilding.
apiVersion: v1
kind: ConfigMap
metadata:
  name: loadr-plan
data:
  perf.yaml: |
    name: k8s-fleet
    description: distributed run submitted from a Job
    defaults:
      http:
        base_url: https://api.example.com
    scenarios:
      fleet:
        executor: constant-arrival-rate
        rate: 600                 # total across ALL agents
        duration: 10m
        pre_allocated_vus: 300
        max_vus: 900
        flow:
          - request: { name: search, url: "/search?q=stress", checks: [ { type: status, equals: 200 } ] }
    thresholds:
      http_req_duration: [ "p(95)<400", "p(99)<900" ]
      http_req_failed: [ "rate<0.01" ]
---
apiVersion: batch/v1
kind: Job
metadata:
  name: loadr-run
  labels: { app: loadr, role: run }
spec:
  backoffLimit: 0
  template:
    metadata:
      labels: { app: loadr, role: run }
    spec:
      restartPolicy: Never
      volumes:
        - name: plan
          configMap: { name: loadr-plan }
      containers:
        - name: run
          image: ghcr.io/levantar-ai/loadr:v1
          # Submit to the controller API; exit code reflects thresholds (0/99).
          args: ["run", "--controller", "loadr-controller:6464", "/plans/perf.yaml"]
          volumeMounts:
            - { name: plan, mountPath: /plans }

View raw: examples/k8s/run-job.yaml

Related files: k8s/controller.yaml · k8s/agents.yaml · k8s/README.md

What it shows

  • Controller + agents as workloads
  • One-shot run Job
  • Bundled Dockerfile