Configuring Environments
Create a Lenses environment, start its agent, and connect Kafka services
Use an environment to represent one Kafka setup in Lenses. Each environment needs one Lenses Agent. The agent authenticates to Lenses with an agent key, then connects to Kafka and other services with a provisioning file.
For the core model, see Concepts.
Before you start
Make sure you have:
access to Lenses
Kafka broker addresses
any Schema Registry, Kafka Connect, alerting, or monitoring endpoints you use
any TLS or mTLS
JKSfilesnetwork access from the agent to each target service
Create the environment
Open Environments from the left navigation. Select + in the header, or use the action on Home.


Enter:
environment name
optional description
tier, such as
dev,staging, orprod
After you create the environment, copy the agent key.
The agent key connects the agent to Lenses. It does not configure Kafka or any other service.
Start the agent
Copy the startup command shown in the UI and run it where your agent will live.
The generated command assumes the default Lenses Docker Compose network. If you run the agent elsewhere, update hostnames, ports, and network routing to match your deployment.

Configure service connections
When the agent appears, select Start configuration. You can also wait for the agent to connect first, then open the configuration tab.
If the agent starts with only an agent key, it connects to Lenses only. It does not connect to Kafka until you apply a provisioning file. For automation details, see Provisioning. The schema is available in the JSON schema repository.
The configuration editor uses YAML. Use the left-side presets and toggles to insert starter blocks into the editor.
Select the connection type and preset that matches your setup. For example, Kafka over mTLS or Confluent Cloud. Then replace every placeholder value with real settings, such as broker addresses, usernames, ports, and secrets.
Fill in every required value before you test or apply. Use the editor problem panel to catch missing or invalid fields.

Some connection types support more than one entry. Common examples are Kafka Connect clusters and alert or monitoring integrations.
TLS and mTLS files
If your services use TLS or mTLS, upload the required JKS files before you apply the configuration.
Uploaded file names must exactly match the file names referenced in the editor. For example, kafka-truststore.jks.

Metrics and advanced settings
The presets do not cover every option. The placeholder YAML includes extra sections as comments. Uncomment and edit those blocks when you need metrics or advanced settings.
Test the configuration
Select the beaker icon in the top-right of the editor to test the provisioning file. 
Lenses validates the file and shows errors in the editor and the problem panel.
Apply the configuration
Select Apply to Agent when the test passes. Then open Agent Logs to follow startup and service connection status.
Initial discovery can take a few minutes. Topics and optional services may appear gradually.
Verify the environment
Confirm these checks after apply:
the agent shows as connected
Kafka appears in the environment
topics start loading
optional services, such as Schema Registry or Kafka Connect, appear if configured
Agent Logs show successful connections and no repeated errors
Troubleshooting
If the environment does not connect, check:
the
agent keyis correctbroker addresses and ports are reachable from the agent
TLS or mTLS files are uploaded and named exactly as referenced
the YAML has no validation errors
credentials and secrets are valid
firewalls, DNS, and container networking allow access to each service
Last updated
Was this helpful?

