# Helm Chart (/docs/local/helm_chart)

Please follow this guidance to deploy LibreChat on Kubernetes using Helm, adjusting as needed for your specific use case. Other Helm charts contributed by the community are listed below in the [Community Helm Charts](#community-helm-charts) section.

## Prerequisites

* A running Kubernetes cluster
* _Local_ installations of `kubectl` and Helm

## Configuration

1. Use the [Credentials Generator](/toolkit/creds_generator) to generate secure values for `CREDS_KEY`, `JWT_SECRET`, `JWT_REFRESH_SECRET` and `MEILI_MASTER_KEY`.
Place them in a Kubernetes Secret like this (if you change the secret name, remember to update your Helm values):

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: librechat-credentials-env
  namespace: <librechat-chart-namespace>
type: Opaque
stringData:
  CREDS_KEY: <generated value>
  JWT_SECRET: <generated value>
  JWT_REFRESH_SECRET: <generated value>
  MEILI_MASTER_KEY: <generated value>
```
2. Add credentials for the Kubernetes Secret (dependent on the desired provider):

```yaml
apiVersion: v1
kind: Secret
. . . .

  OPENAI_API_KEY: <your secret value>
```
3. Apply the Secret to the Cluster:

## Install Helm Chart

To install the helm chart run: 

`helm install <deployment-name> oci://ghcr.io/danny-avila/librechat-chart/librechat`

<details>
  <summary>Development version</summary>

In the repo's root directory, run: 

`helm install <deployment-name> ./helm/librechat`
</details>

Similar to other Helm charts, there exists a [values file](https://github.com/danny-avila/LibreChat/blob/main/helm/librechat/values.yaml) that outlines the default settings and indicates which configuration options can be modified.

Create a `values.yaml` file populated with the values you want to modify from the default.

Install the Helm chart: `helm install librechat oci://ghcr.io/danny-avila/librechat-chart/librechat --values <values-override-filel>`

## Uninstall the Helm Chart

To uninstall the Helm Chart: `helm uninstall <deployment-name>`

Example: `helm uninstall librechat`

## Migrate 1.x -> 2.x
If you used the chart before version 2.x you may need to update the `value` structure.

1. Move Config to librechat.configEnv:
```diff
- env:
-     ALLOW_EMAIL_LOGIN: "true"
-     ALLOW_REGISTRATION: "true"
+ librechat:
+   configEnv:
+     ALLOW_REGISTRATION: "true"
+     ALLOW_EMAIL_LOGIN: "true"
```

2. Consolidate all Secret values to a single Secret as described in [Configuration Step 1](#configuration). 
3. To leverage an external MongoDB instance, refer to the [values file](https://github.com/danny-avila/LibreChat/blob/main/helm/librechat/values.yaml) of the Chart, deactivate the components accordingly and change the FQDN of the Mongodb instance. This is recommended if data already exists in this externally managed MongoDB instance.
  
## Community Helm Charts
- [LibreChat Helm Chart by Blue Atlas Helm Charts](https://github.com/bat-bs/helm-charts/tree/main/charts/librechat) # will be depricated soon as its migrated here
- Submitted by [@dimaby](https://github.com/dimaby) on GitHub: [PR #2879](https://github.com/danny-avila/LibreChat/pull/2879)
