What it does
- Discovery: it reads your Kubernetes clusters, Azure subscriptions, Terraform state and networks, and FlowShape draws them as a diagram you can keep up to date.
- Live status: it asks your Grafana (Prometheus, Loki, Tempo) how each item on a diagram is doing, so the diagram shows health, recent logs and traces.
What it collects goes from the agent straight to your browser, on your computer. It never passes through FlowShape's servers. The agent comes with FlowShape Pro, and it is one readable JavaScript file: you can see exactly what runs in your network.
Quick start
You need Node.js 20 or newer, on macOS, Linux or Windows. Nothing else to install.
-
In FlowShape, open Integrations and pick a source: Kubernetes,
Azure, Terraform, a network scan or Grafana. Download the agent there: one file,
flowshape-agent.mjs. -
Run the command FlowShape writes for you, in the folder you downloaded it to. For
example:
node flowshape-agent.mjs --key <key> --kubernetes -
Back in FlowShape, press Look for the agent. FlowShape finds it by
itself, and the agent's window says
FlowShape connected.
To try it without any tools or access, use the sample environments built into it:
node flowshape-agent.mjs --demo
Your browser asks first
Chrome and Edge ask before a website may talk to apps on your computer. The first time FlowShape looks for the agent, your browser asks whether FlowShape may connect to devices on your local network (or apps on this device). Choose Allow: that is how the page reaches the agent.
Blocked it by mistake? Click the icon at the left of the address bar, open Site settings, set Local network access (or Loopback network; in Brave, Localhost access) to Allow, then reload the page. FlowShape tells you when your browser is blocking it.
Sources
Each source runs the vendor's own tool, without a shell, with the access of whoever runs the agent. Read access is enough everywhere.
| Option | Runs | Needs |
|---|---|---|
--kubernetes--context <name> |
kubectl get deployments, stateful sets, daemon sets, services, ingresses, config maps, volume claims, cron jobs, jobs and pods in all namespaces; then Secrets, their values dropped |
kubectl with the built-in view role; listing Secrets is optional |
--azure--subscription <id> |
az graph query: Azure Resource Graph, the first 1,000 resources |
az login, the Reader role |
--terraform <dir> |
terraform show -json in that folder (repeatable) |
terraform init has run there; Terraform 0.15 or newer |
--nmap <range> |
nmap -sV --traceroute on the range (repeatable) |
nmap; root for the traceroute; only networks you own or may test |
--file <path> |
a file you collected yourself (repeatable) | |
--demo |
the sample environments built into the agent | nothing |
--grafana <url> |
Grafana's data source API: Prometheus, Loki and Tempo | a Viewer service-account token |
Several sources can run in one agent. Add --every 15m (or
1h, 90s) to collect again on a schedule; without it, the
agent collects once when it starts, then whenever FlowShape asks.
-
Kubernetes Secrets show which workloads use which Secret. Reading
them needs
listonsecretscluster-wide, which theviewrole doesn't give. Without it, the agent skips them and the diagram shows the workloads only. With it, each Secret's values are dropped as soon as kubectl returns them. - Terraform reads state through the backend configured in that folder, with your credentials for it. Values it marks sensitive are dropped.
Azure on Windows
On Windows, az is a batch file, which the agent can't run without a
shell. Run the query yourself, then give the agent the file:
az graph query -q "Resources | project id, name, type, resourceGroup, subscriptionId, location, sku, kind, properties" --first 1000 -o json > azure.json
node flowshape-agent.mjs --key <key> --file azure.json
Live status from Grafana
In Grafana, create a service account with the Viewer role and add a token to it. Then start the agent with the token in an environment variable, so it stays out of your shell history:
FLOWSHAPE_GRAFANA_TOKEN=<token> node flowshape-agent.mjs --key <key> --grafana https://grafana.example.com
-
The token comes from
FLOWSHAPE_GRAFANA_TOKENor--grafana-token-file <path>. It stays on this machine; FlowShape only gets the answers, and Grafana's address without any user name or password in it. -
Matching: an item on a diagram is matched by name to the series
whose
servicelabel has that name. Use--grafana-label <label>for another label. -
Queries: the defaults read
up(orservice_up),http_requests_totalandhttp_request_duration_seconds_bucket. Replace any of them with--grafana-queries <file.json>: a JSON object with any of the keysstatus,errors,latency,rate,logsandtraceTag.$label,$namesand$nameare filled in.
Options
Besides the sources and the Grafana options:
| Option | Does |
|---|---|
--key <key> | the key FlowShape uses, 16 characters or more; a random one is made when none is given |
--key-file <path> | the key from a file (or FLOWSHAPE_AGENT_KEY) |
--port <7777> | the port to listen on |
--host <127.0.0.1> | the address to listen on (see Another machine) |
--origin <url> | another FlowShape address that may use the agent (repeatable) |
--every <15m> | collect again on a schedule |
--help | all options |
--key on the command line ends up in your shell history and in the
process list, visible to other users of the machine. On a shared machine, use
FLOWSHAPE_AGENT_KEY or --key-file.
Another machine
FlowShape reaches an agent on your own computer only: browsers don't let a secure page call plain HTTP elsewhere, and the agent is safest bound to 127.0.0.1. To read a network from another machine, run the agent there as usual, and bring its port to your computer over SSH. Leave this running:
ssh -N -L 7777:127.0.0.1:7777 you@that-machine
FlowShape writes this command for you when you tick It runs on another machine.
Security and your data
- It never contacts FlowShape or any third party. The only outgoing connections are the tools you enable and, with
--grafana, your own Grafana. - Only this computer can reach it: it listens on 127.0.0.1 by default, and warns when started with another
--host. While on 127.0.0.1, it refuses requests addressed to any other name, so a website can't reach it through DNS rebinding. - Every request needs its key, compared in constant time; keys shorter than 16 characters are refused.
- Other websites are refused: only FlowShape's page (and any
--originyou add) may use it. - Tools run without a shell, with fixed arguments and the rights of whoever runs it. Give it a read-only identity: Azure Reader, the Kubernetes
viewrole, a Grafana Viewer token. -
Secrets are dropped before anything leaves it: Kubernetes Secrets
keep their name, type and labels but lose their values; values Terraform marks
sensitive are removed, in state and plans; files given with
--fileget the same treatment. Anything a tool prints that isn't marked secret is passed on as printed: ConfigMaps, an environment variable written straight into a pod spec, tags. Keep secrets in Secrets and sensitive variables. - Nothing is stored on disk. The last results stay in memory until the agent stops.
To report a security problem, write to hello@flowshape.io with "Security" in the subject.
Audit it yourself
Run the agent with its samples and ask it what it hands out, with your own key:
node flowshape-agent.mjs --demo --key my-own-key-1234567890
curl -H "Authorization: Bearer my-own-key-1234567890" http://127.0.0.1:7777/v1/info
curl -H "Authorization: Bearer my-own-key-1234567890" http://127.0.0.1:7777/v1/sources/demo-kubernetes
Troubleshooting
FlowShape keeps waiting for the agent
- Is the agent running, with the command FlowShape shows? Its window says
FlowShape connectedonce the page reaches it. - Did your browser ask about local network access? Choose Allow (see above).
- On another machine: is the SSH tunnel open?
"Another agent answers, started with a different key", or "Port 7777 is in use"
An older agent is still running on that port. Stop it (Ctrl+C), then run the command FlowShape shows now.
A source says a tool isn't installed
The agent uses az, kubectl, terraform and nmap from the machine's PATH. Install the one named, or run the agent where it is.
"Grafana refused the token"
The token needs the Viewer role, and must belong to the Grafana organization you gave with --grafana.
HTTP API
Every route needs Authorization: Bearer <key>.
| Route | Answers |
|---|---|
GET /v1/info | the version, the machine's name and the sources, with when each was collected; with --grafana, Grafana's address and label |
POST /v1/collect | collects every source again, then answers like /v1/info |
GET /v1/sources/<id> | one source's output, secrets dropped (kubectl and Terraform JSON is re-serialised) |
GET /v1/monitoring | Grafana's data sources: metrics, logs, traces |
GET /v1/monitoring/status?names=a,b | per name: up, the share of 5xx answers, p95 latency, requests a minute |
GET /v1/monitoring/logs?name=a | the latest log lines of one item |
GET /v1/monitoring/traces?name=a | recent traces through one item, with links into Grafana |
License
The agent is source-available, not open source. Its licence is PolyForm Strict 1.0.0: you may use it for noncommercial purposes, and may not distribute it or make changes or new works based on it. Using it with FlowShape, commercially included, is covered by FlowShape's Terms. For other commercial use or other terms, write to hello@flowshape.io.