> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/devx/5.5/deployment/installation/helm.md).

# Helm

This page describes installing Lenses in Kubernetes via Helm.

{% hint style="info" %}
Only Helm version 3 is supported.

On start-up, Lenses will be in bootstrap mode unless it has an existing Kafka Connection. Enable [provisioning ](https://docs.lenses.io/latest/devx/5.5/deployment/installation/automation.md)to automate the creation of connections.
{% endhint %}

First, add the Helm Chart repository using the Helm command line:

```bash
helm repo add lensesio https://helm.repo.lenses.io
helm repo update
```

Use helm to install Lenses with default values:

```bash
helm install lenses lensesio/lenses --namespace lenses --create-namespace
```

The default install of Lenses will place Lenses in bootstrap mode, you can add the connections to Kafka manually and upload your license or automation with provisioning. Please refer to the GitHub **`values.yaml`** for all options.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Helm</strong></td><td>Helm Chart Repo</td><td><a href="https://github.com/lensesio/lenses-helm-charts">https://github.com/lensesio/lenses-helm-charts</a></td></tr></tbody></table>

## Provisioning

To automatically provision the connections to Kafka and other systems set the **`.Values.lenses.provision.connections`** to be the **YAML** definition of your connections. For a full list of the connection types supported see [Provisioning](https://docs.lenses.io/latest/devx/5.5/deployment/installation/automation.md).

The chart will render the full YAML specified under this setting as the **`provisioning.yaml`** file.

Alternatively you can use a second YAML file, which contains only the connections pass them at the command line when installing:

{% code fullWidth="false" %}

```bash
helm install lenses \
charts/lenses \
--values charts/lenses/values.yaml \
--values provisioning.yaml
```

{% endcode %}

{% hint style="warning" %}
You must explicitly enable provisioning via **lenses.provision.enabled: true** otherwise Lenses will start in bootstrap mode.
{% endhint %}

## Helm Chart components

The chart uses:

1. Secrets to store Lenses Postgres credentials and authentication credentials
2. Secrets to store connection credentials such as Kafka SASL\_SCRAM password or password for SSL JKS stores.
3. Secrets to hold the base64 encoded values of the JKS stores
4. ConfigMap for Lenses configuration overrides
5. Cluster roles and role bindings (optional).

Secrets and config maps are mounted as files under the mount `/mnt`:

1. settings - holds the `lenses.conf`
2. secrets - holds the secrets Lenses and license
3. provision-secrets - holds the secrets for connections in the `provisioning.yaml` file
4. provision-secrets/files - holds any file needed for a connection, e.g. JKS files.

<div data-full-width="false"><figure><img src="https://1626952789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3kFlA2f2XiIvqAjyLMgf%2Fuploads%2Fgit-blob-19f09a4473d6d8d3a8482667440847875ad22e6d%2Fhelm-arch.png?alt=media" alt=""><figcaption></figcaption></figure></div>

### Kubernetes RBAC

Lenses calls the Kubernetes API only to run SQL Processors in `KUBERNETES` mode (`lenses.sql.mode`). In `IN_PROC` or `CONNECT` mode (the default is `IN_PROC`) it makes no Kubernetes API calls, and you can set `rbacEnable: false`.

With `rbacEnable: true` (the default), the chart creates a `ClusterRole` and `ClusterRoleBinding` for the ServiceAccount Lenses runs as, so that Lenses can deploy SQL Processors to any namespace. Unless you set `serviceAccount`, that is the namespace's `default` ServiceAccount, so the permissions also apply to every other pod in the namespace that does not set its own ServiceAccount.

{% hint style="info" %}
From chart 5.5.25 the `ClusterRole` only grants the permissions Lenses uses. It no longer grants `list` or `watch` on Secrets, write access to pods, or access to services, ingresses, statefulsets, persistent volumes or namespace creation.
{% endhint %}

#### Recommended: a dedicated ServiceAccount and namespace-scoped RBAC

From chart 5.5.25 you can give Lenses its own ServiceAccount and limit it to the namespaces your SQL Processors run in:

```yaml
serviceAccount:
  create: true
namespaceScope: true
lenses:
  sql:
    mode: KUBERNETES
    namespaces:
      - lenses
      - lenses-processors
```

* `serviceAccount.create` creates a ServiceAccount named after the release, for example `lenses`. Put cloud IAM annotations, such as EKS IRSA or GKE Workload Identity, in `serviceAccount.annotations`.
* `namespaceScope` creates a `Role` and `RoleBinding` in each namespace of `lenses.sql.namespaces` instead of the `ClusterRole`. Without a list, it uses the release namespace.
* `lenses.sql.namespaces` also sets `lenses.kubernetes.namespaces`, so that Lenses only uses those namespaces. The namespaces must already exist.

{% hint style="warning" %}
Before you enable this on an existing installation:

* List every namespace your SQL Processors run in:

  ```bash
  kubectl get deployments -A -l lenses.io/lenses-user=Lenses \
    -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name
  ```

  Lenses cannot manage processors in namespaces missing from `lenses.sql.namespaces`. They keep running, but Lenses shows them as stopped, and deleting one in Lenses leaves its Deployment running. Adding the namespace and upgrading again restores them.
* Move anything you attached to the `default` ServiceAccount, such as `imagePullSecrets` or cloud IAM annotations, to `image.imagePullSecrets` and `serviceAccount.annotations`.
  {% endhint %}

To keep cluster-wide access with a dedicated ServiceAccount, set `serviceAccount.create: true` and leave `namespaceScope` at `false`.

#### Managing RBAC yourself

Set `rbacEnable: false`, create a `Role` and `RoleBinding` in each namespace Lenses deploys SQL Processors to, and limit Lenses to those namespaces. [Kubernetes permissions for SQL Processors](https://docs.lenses.io/latest/devx/5.5/deployment/configuration/sql-processor-deployment.md#kubernetes-permissions) lists the rules.

### lenses.conf

The main configurable options for `lenses.conf` are available in the `values.yaml` under the **`lenses`** object. These include:

* Authentication
* Database connections
* SQL processor configurations

To apply other static configurations use **`lenses.append.conf`**, for example:

```yaml
lenses:
  append:
    conf: |
      lenses.interval.user.session.refresh=40000
```

### Authentication secrets

Set accordingly under\*\*`lenses.security.`\*\*

```yaml
lenses:
  security:
    defaultUser:
      username: admin
      password: admin
```

For SSO set **`lenses.security.saml`**

```yaml
lenses:
  security:
    saml:
      enabled: true
      baseUrl: "https://lenses-prod.eastus2.cloudapp.azure.com"
      provider: "azure"
      keyStoreFileData: |-
                somebase64encodedvalue
      keyStorePassword: "password"
      keyPassword: "password"
      metadataFileData: |-
                somebase64encodedvalue=
```

### Postgres

To use Postgres as the backing store for Lenses set the details in the `lenses.storage.postgres object`.

```
storage:
    postgres:
      enabled: false
      host:
      port: 
      username:
      password:
      database:
      schema:        
```

If Postgres is not enabled a default embedded H2 database is used. To enable persistence for this data:

```yaml
persistence:
  enabled: true
  accessModes:
    - ReadWriteOnce
  size: 5Gi
```

### External Secrets

The chart relies on secrets for sensitive information such as Passwords. Secrets can rotate and are commonly stored in an external store such as Azure KeyVault, Hashicorp Vault or AWS Secrets Manager.

If you wish to have the chart use external secrets that are synchronized with these providers, set the following for the Lenses user:

```yaml
  security:
    defaultUser:  
      # username: external # "external" that tells Lenses to look for a Secret
      # password: external # Same here.
      # usernameSecretKeyRef:
      #   name: my-existing-secret
      #   key: the-username-key
      # passwordSecretKeyRef:
      #   name: my-existing-secret
      #   key: the-password-key
```

For Postgres, add additional ENV variables via the **`lenses.additionalEnv`** object to point to your secret and set the username and password to **external** in the Postgres section.

```yaml
      # - name: LENSES_STORAGE_POSTGRES_PASSWORD
      #   valueFrom:
      #     secretKeyRef:
      #       name: [SECRET_RESOURCE_NAME]
      #       key: [SECRET_RESOURCE_KEY]
```

### Ingress & Services

{% hint style="info" %}
While the chart supports setting TLS on Lenses itself we recommend placing it on the Ingress resource
{% endhint %}

Ingress and service resources are supported.

Enabled an Ingress resource in the `values.yaml`:

```yaml
ingress:
  enabled: false
  host:
  annotations: {}
  tls:
    enabled: false
    crt: |-
    key: |-
```

Enable a service resource in the `values.yaml`:

```yaml
# Lenses service
service:
  enabled: true
  type: ClusterIP
  annotations: {}
  externalTrafficPolicy:
  loadBalancerIP: 130.211.x.x
  loadBalancerSourceRanges:
    - 0.0.0.0/0
```

### Controlling resources

To control the resources used by Lenses:

```yaml
# Resource management
resources:
  requests:
    cpu: 1
    memory: 4Gi
  limits:
    cpu: 2
    memory: 5Gi
```

### Enabling SQL Processors in K8s mode

To run SQL Processors in `KUBERNETES` mode and control their defaults:

```yaml
lenses:
  sql:
    # processorImage: lensesioextra/sql-processor
    # processorImageTag: 5.5
    mode: KUBERNETES
    heap: 1024M
    minHeap: 128M
    memLimit: 1152M
    memRequest: 128M
    livenessInitialDelay: 60 seconds
```

{% hint style="info" %}
To control the namespaces Lenses can deploy SQL Processors to, use the **`lenses.sql.namespaces`** value (chart 5.5.25 and later). See [Kubernetes RBAC](#kubernetes-rbac).
{% endhint %}

### Prometheus metrics

Prometheus metrics are automatically exposed on port 9102 under `/metrics`.

## Example Values files

For Connections, see [Provisioning examples](https://docs.lenses.io/latest/devx/5.5/deployment/installation/automation/provisioning-examples.md). You can also find examples in the [Helm chart repo](https://github.com/lensesio/lenses-helm-charts).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lenses.io/latest/devx/5.5/deployment/installation/helm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
