Lens on Kubernetes
The Spanway Helm chart can deploy Lens next to the gateway, or connect the gateway to a Lens service that already runs in your cluster. Lens stores agent traces in ClickHouse, analyses them, and serves the Lens workspace in the Admin UI. The chart's lensWorker values control which mode is used and how the two services authenticate to each other.
A real-world scenario
A platform team already runs the gateway with the all-in-one chart and wants agent tracing for three teams. They turn on the bundled Lens in the same release, so the chart creates Lens, its ClickHouse and the shared secrets, and the gateway pods get the connection settings without anyone copying a secret by hand.
Steps
-
Add the
lensWorkervalues shown in Bundled installation to your values file, including the public address of Lens, given bylensWorker.ingressorlensWorker.publicUrl. -
Upgrade the release with the published chart.
helm upgrade --install spanway oci://registry.spanway.ai/spanway/charts/spanway-helm -n spanway -f values.yaml -
Check the connection from the gateway.
curl https://<gateway host>/lens/service -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -
Open Lens under Observability in the Admin UI. The workspace replaces the setup panel.
Expected result
The Lens deployment and ClickHouse are running, /lens/service reports the worker as reachable, and the Admin UI opens the Lens workspace.
Modes
lensWorker.mode is one of disabled, bundled or external.
| Mode | What the chart does |
|---|---|
disabled | No Lens resources. The Admin UI shows the setup panel. |
bundled | Deploys the Lens worker and a ClickHouse instance, and generates the gateway secret and service token. |
external | Deploys nothing for Lens and configures the gateway to talk to a Lens service you provide. |
Bundled installation
lensWorker:
mode: bundled
enabled: true
replicaCount: 1
image:
repository: <the Lens worker image from your preview access>
tag: "<version>"
clickhouse:
enabled: true
storage: 20Gi
storageClassName: null
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
memory: 2Gi
clickhouseDatabase: spanway
retentionDays: 14
helm upgrade --install spanway oci://registry.spanway.ai/spanway/charts/spanway-helm --version 2.0.0 -f values.yaml
The chart creates the Lens deployment, service and ClickHouse with a persistent volume, and sets SPANWAY_LENS_URL, SPANWAY_LENS_PUBLIC_URL, LENS_GATEWAY_SECRET and SPANWAY_LENS_SERVICE_TOKEN on the gateway pods from generated secrets. retentionDays controls how long traces are kept. Gateway pods reach the bundled Lens through its in-cluster service, so lensWorker.externalUrl is not used in this mode. The public address, which the Admin UI opens and agents send traces to, comes from lensWorker.publicUrl when you set it. Otherwise it is lensWorker.ingress.host when lensWorker.ingress.enabled is true, or /lens-ingest on the gateway's own ingress when that ingress has exactly one host. With none of these the chart stops with lensWorker.publicUrl is required when there is no single ingress hostname. lensWorker.standaloneUrl optionally overrides the address the Lens worker uses for itself, which otherwise follows the public address.
Spanway is in private preview. The container images and Helm charts will be published soon. To request access, write to sales@spanway.ai, and preview customers receive download instructions in their onboarding pack.
Existing deployment
When Lens already runs in the cluster, or in another cluster, connect the gateway to it instead of installing a second copy. The Admin UI's setup panel links here as Helm setup, and its Check setup button confirms whether a service is reachable.
lensWorker:
mode: external
externalUrl: http://lens:4318
publicUrl: https://lens.example.com
externalServiceName: lens
gateway:
secretName: lens-gateway-secret
secretKey: gateway-secret
serviceTokenSecret:
name: lens-service-token
key: service-token
| Value | Meaning |
|---|---|
externalUrl | The address gateway pods call to reach the existing Lens, set as SPANWAY_LENS_URL. Required. |
publicUrl | The public address of Lens, which the Admin UI opens and agents send traces to, set as SPANWAY_LENS_PUBLIC_URL. Required, the chart stops with lensWorker.publicUrl is required for external Lens without it. |
externalServiceName | Optional. The name of the existing Lens service in the gateway's namespace. When set, the gateway's ingress routes /lens-ingest to it. |
gateway.secretName, gateway.secretKey | Secret holding the shared gateway secret. The key defaults to gateway-secret. The name is required in external mode, and the chart stops with lensWorker.gateway.secretName is required for external Lens without it. |
serviceTokenSecret.name, serviceTokenSecret.key | Secret holding the service token. The key defaults to service-token. The name is required in external mode, and the chart stops with lensWorker.serviceTokenSecret.name is required for external Lens without it. |
Create the two secrets with the values the existing Lens deployment uses, so both sides agree. Distinct values must be provisioned for each gateway that connects.
kubectl create secret generic lens-gateway-secret --from-literal=gateway-secret="$(openssl rand -hex 32)"
kubectl create secret generic lens-service-token --from-literal=service-token="$(openssl rand -hex 32)"
Other values
These lensWorker values apply to the bundled Lens.
| Value | Default | Meaning |
|---|---|---|
adminTokenSecret.name, adminTokenSecret.key | generated, admin-token | Secret holding LENS_ADMIN_TOKEN, the private login credential of the Lens worker. Left empty, the chart generates one and keeps it across upgrades. Name your own Secret when your secret store must own it. |
clickhouseSecret.name, clickhouseSecret.key | empty, url | Secret holding the URL of an existing ClickHouse server, with its credentials. Setting the name turns the bundled ClickHouse off. |
clickhouseDatabase | spanway | The database Lens uses on ClickHouse. The gateway reads the same value for erasure. |
retentionDays | 14 | How many days traces and request log copies are kept. |
retainResources | false | When true, helm uninstall keeps the Lens secrets and the ClickHouse volume, so a reinstall finds the data again. |
extraEnv, extraEnvFrom | empty | More environment variables for the worker, as a list or from Secrets and ConfigMaps, for the worker settings in the settings reference. |
ingress.path | /v1/ | The path the Lens ingress serves when ingress.enabled is true, the trace intake that agents call. |
tmpSizeLimit | 1Gi | The size of the worker's scratch volume. |
resources | 100m CPU and 256Mi requested, 2Gi limit | The worker's resource requests and limits. |
Lens without a gateway
Lens also ships as its own chart, for a team that wants agent traces and findings before it runs the gateway. It installs the Lens worker, its web interface and ClickHouse on one persistent volume, and needs no gateway or PostgreSQL. Install it with an exact version.
helm upgrade --install lens oci://registry.spanway.ai/spanway/charts/lens --version 2.0.0 --namespace lens --create-namespace
kubectl --namespace lens port-forward service/lens 4318:4318
kubectl --namespace lens get secret lens-admin -o jsonpath='{.data.admin-token}' | base64 --decode
Open http://localhost:4318/ui/ and sign in with the token the last command prints, and keep it private. Upgrades reuse the generated token, and uninstalling keeps it and the ClickHouse volume. To use an existing ClickHouse server, name a Secret holding its URL in clickhouseSecret.name, which turns the bundled ClickHouse off. A standalone Lens has no gateway, so it has no data policies, no Admin UI page and no audit rows, and it keeps span content only with LENS_KEEP_SPAN_CONTENT=true. Connect it to a gateway later through Existing deployment.
Verifying
After the rollout, GET /lens/service on the gateway reports the connection status, and the Lens page in the Admin UI replaces the setup panel with the workspace. If the routes return 503, the message names the setting the gateway is missing, SPANWAY_LENS_URL, LENS_GATEWAY_SECRET or SPANWAY_LENS_SERVICE_TOKEN. Check the gateway pod's environment and the secret names in your values. For a local setup, see Lens with Docker Compose.
Errors
| What you see | What it means | Fix |
|---|---|---|
/lens routes answer 503 naming a setting | The gateway pods lack SPANWAY_LENS_URL, LENS_GATEWAY_SECRET (32 to 512 bytes) or SPANWAY_LENS_SERVICE_TOKEN (at least 32 characters). | Check the pod environment and the secret names in your values. |
The chart fails with lensWorker.serviceTokenSecret.name is required for external Lens or lensWorker.gateway.secretName is required for external Lens | External mode needs both secrets named. | Create the secrets and set both names. |
| The Admin UI cannot open the workspace | The public Lens address is wrong. It is lensWorker.publicUrl, or in bundled mode the lensWorker.ingress host when publicUrl is unset. | Set lensWorker.publicUrl to the address browsers reach Lens on, or configure lensWorker.ingress. |
The chart fails with lensWorker.publicUrl is required | External mode always needs publicUrl, and bundled mode needs it when neither lensWorker.ingress nor a single-host gateway ingress is configured. | Set lensWorker.publicUrl. |
| An external Lens rejects the gateway | The secrets differ from the ones the existing Lens uses. | Create both secrets with the values that Lens uses. |
| ClickHouse pod stays pending | No storage class can provide its persistent volume. | Set a storage class for the ClickHouse volume. |
Logs
The gateway pods log the Lens content policy warnings the Lens overview lists. The worker logs to its own pod, so read it with kubectl logs deployment/<release>-lens.