Deploy the Langflow development environment on Kubernetes
The Langflow integrated development environment (IDE) Helm chart is designed to provide a complete environment for developers to create, test, and debug their flows. It includes both the Langflow API and visual editor.
Prerequisites
- A Kubernetes cluster
- kubectl
- Helm
Prepare a Kubernetes cluster
This example uses Minikube, but you can use any Kubernetes cluster.
-
Create a Kubernetes cluster on Minikube:
_10minikube start -
Set
kubectl
to use Minikube:_10kubectl config use-context minikube
Install the Langflow IDE Helm chart
-
Add the repository to Helm, and then update it:
_10helm repo add langflow https://langflow-ai.github.io/langflow-helm-charts_10helm repo update -
Install Langflow with the default options in the
langflow
namespace:_10helm install langflow-ide langflow/langflow-ide -n langflow --create-namespace -
Check the status of the pods:
_10kubectl get pods -n langflow
Access the Langflow IDE
Enable local port forwarding to access Langflow from your local machine:
-
Make the Langflow API accessible from your local machine at port 7860:
_10kubectl port-forward -n langflow svc/langflow-service-backend 7860:7860 -
Make the visual editor accessible from your local machine at port 8080:
_10kubectl port-forward -n langflow svc/langflow-service 8080:8080
Now you can do the following:
- Access the Langflow API at
http://localhost:7860
. - Access the visual editor at
http://localhost:8080
.
Modify your Langflow IDE deployment
You can modify the Langflow IDE Helm chart's values.yaml
file to customize your deployment.
The following sections describe some common modifications.
If you need to set secrets, Kubernetes secrets are recommended.
Deploy a different Langflow version
The Langflow IDE Helm chart deploys the latest Langflow version by default.
To specify a different Langflow version, set the langflow.backend.image.tag
and langflow.frontend.image.tag
values to your preferred version.
For example:
_10langflow:_10 backend:_10 image:_10 tag: "1.0.0a59"_10 frontend:_10 image:_10 tag: "1.0.0a59"
Use external storage for the Langflow database
The Langflow IDE Helm chart uses the default Langflow database configuration, specifically a SQLite database stored in a local persistent disk.
If you want to use an external PostgreSQL database, use postgresql
chart or externalDatabase
to configure the database connection in values.yaml
.
- postgresql
- externalDatabase
Use the built-in PostgreSQL chart:
_10postgresql:_10 enabled: true_10 auth:_10 username: "langflow"_10 password: "langflow-postgres"_10 database: "langflow-db"
If you don't want to use the built-in PostgreSQL chart, set postgresql.enabled
to false
, and then configure the database connection in langflow.backend.externalDatabase
:
_22postgresql:_22 enabled: false_22_22langflow:_22 backend:_22 externalDatabase:_22 enabled: true_22 driver:_22 value: "postgresql"_22 port:_22 value: "5432"_22 user:_22 value: "langflow"_22 password:_22 valueFrom:_22 secretKeyRef:_22 key: "password"_22 name: "your-secret-name"_22 database:_22 value: "langflow-db"_22 sqlite:_22 enabled: false
Configure scaling
To configure scaling for the Langflow IDE Helm chart deployment, you must set replicaCount
(horizontal scaling) and resources
(vertical scaling) for both the langflow.backend
and langflow.frontend
.
If your flows rely on a shared state, such as built-in chat memory, you must also set up a shared database when scaling horizontally.
_21langflow:_21 backend:_21 replicaCount: 1_21 resources:_21 requests:_21 cpu: 0.5_21 memory: 1Gi_21 # limits:_21 # cpu: 0.5_21 # memory: 1Gi_21_21 frontend:_21 enabled: true_21 replicaCount: 1_21 resources:_21 requests:_21 cpu: 0.3_21 memory: 512Mi_21 # limits:_21 # cpu: 0.3_21 # memory: 512Mi