What is the Niro agent?
The Niro agent is a lightweight daemon that runs as a Kubernetes Deployment inside your cluster, in theniro-system namespace. It’s the only component you install — everything else is managed by Niro.
The agent is:
- Stateless — cluster state is reconstructed from the Kubernetes API on every heartbeat
- NAT-friendly — all traffic is outbound HTTPS; no inbound ports or VPN required
- Non-invasive — read-only by default; write access requires explicit opt-in
- Self-updating — can roll itself to the latest version if you enable the
self-updatecapability
How the agent works
Enrollment
The agent runs the enrollment flow exactly once when first installed:- Reads the enrollment token from the
NIRO_TOKENenvironment variable - Contacts Niro to exchange the token for a long-lived key
- Stores the key in a Kubernetes Secret in
niro-system - The enrollment token is invalid after this point — the agent uses its key for all future requests
Heartbeat
Every ~15 seconds the agent collects a snapshot and sends it to Niro:Command channel
The agent maintains a persistent connection to Niro. When Niro has a command ready (apply, delete, stream logs, ping), it delivers it over this connection. The agent processes the command, reports the result, and immediately re-establishes the connection. This creates a persistent, low-latency channel with no inbound connectivity requirements.Default RBAC
The agent’s default role is read-only:Capabilities
Capabilities are opt-in, additive, and reversible. Each capability grants additional RBAC permissions and unlocks corresponding features in the Niro dashboard.| Flag | RBAC granted | Dashboard feature |
|---|---|---|
NIRO_ENABLE_PODS=1 | list pods (default on) | Pod inventory |
NIRO_ENABLE_LOGS=1 | pods/log | View logs button on pods |
NIRO_ENABLE_APPLY=1 | create/update/patch/delete on managed resources | Apply to cluster, config management |
NIRO_ENABLE_SELF_UPDATE=1 | patch own Deployment | Agent auto-update |
0:
Setting
NIRO_ENABLE_APPLY=1 grants delete only for managed namespaced resources. Niro never deletes namespaces.Log streaming
When you click View logs in the dashboard, Niro:- Sends a log stream command to the agent with the target pod/container
- The agent streams the container logs and forwards them to Niro in batches
- The dashboard subscribes to the stream and renders lines in real time
Self-update
IfNIRO_ENABLE_SELF_UPDATE=1, the agent can roll itself to a new version when Niro signals an update is available. The agent patches its own Deployment’s image tag, the new pod starts up, and Niro reflects the updated version within one status cycle.
Protocol versioning
The agent protocol is versioned and backward compatible — older agents continue to heartbeat and receive commands, they just don’t report capabilities or features added in newer versions. You can update agents at any time without coordination.Related
- Connect a Cluster — install the agent and enroll a cluster
- Agent Capabilities — full capability reference
- Manage Secrets and ConfigMaps — create configuration resources for apps
- Stream Pod Logs — enable and use live log streaming