earayu
commited on
Commit
·
0977cf4
1
Parent(s):
b1d81f4
feat: update README
Browse files- k8s-deploy/README.md +42 -44
k8s-deploy/README.md
CHANGED
@@ -4,7 +4,7 @@ This is the Helm chart for LightRAG, used to deploy LightRAG services on a Kuber
|
|
4 |
|
5 |
There are two recommended deployment methods for LightRAG:
|
6 |
1. **Lightweight Deployment**: Using built-in lightweight storage, suitable for testing and small-scale usage
|
7 |
-
2. **
|
8 |
|
9 |
## Prerequisites
|
10 |
|
@@ -16,19 +16,31 @@ Make sure the following tools are installed and configured:
|
|
16 |
* Any standard cloud or on-premises Kubernetes cluster (EKS, GKE, AKS, etc.) also works.
|
17 |
|
18 |
* **kubectl**
|
19 |
-
* The Kubernetes command-line
|
20 |
* Follow the official guide: [Install and Set Up kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl).
|
21 |
|
22 |
* **Helm** (v3.x+)
|
23 |
-
* Kubernetes package manager used
|
24 |
* Install it via the official instructions: [Installing Helm](https://helm.sh/docs/intro/install/).
|
25 |
|
26 |
-
|
27 |
## Lightweight Deployment (No External Databases Required)
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
```bash
|
|
|
32 |
helm upgrade --install lightrag ./lightrag \
|
33 |
--namespace rag \
|
34 |
--set-string env.LIGHTRAG_KV_STORAGE=JsonKVStorage \
|
@@ -45,82 +57,68 @@ helm upgrade --install lightrag ./lightrag \
|
|
45 |
--set-string env.EMBEDDING_BINDING_API_KEY=$OPENAI_API_KEY
|
46 |
```
|
47 |
|
48 |
-
|
49 |
|
50 |
-
You can use it directly like this:
|
51 |
```bash
|
52 |
-
|
53 |
-
|
54 |
-
bash ./install_lightrag_dev.sh
|
55 |
-
```
|
56 |
-
Then you can Access the application
|
57 |
-
```bash
|
58 |
-
1. Run this port-forward command in your terminal:
|
59 |
-
kubectl --namespace rag port-forward svc/lightrag-dev 9621:9621
|
60 |
|
61 |
-
|
62 |
-
|
63 |
```
|
64 |
|
65 |
-
##
|
66 |
|
67 |
### 1. Install Databases
|
68 |
> You can skip this step if you've already prepared databases. Detailed information can be found in: [README.md](databases%2FREADME.md).
|
69 |
|
70 |
We recommend KubeBlocks for database deployment. KubeBlocks is a cloud-native database operator that makes it easy to run any database on Kubernetes at production scale.
|
71 |
-
FastGPT also use KubeBlocks for their database infrastructure.
|
72 |
|
73 |
First, install KubeBlocks and KubeBlocks-Addons (skip if already installed):
|
74 |
```bash
|
75 |
bash ./databases/01-prepare.sh
|
76 |
```
|
77 |
|
78 |
-
Then install the required databases. By default, this will install PostgreSQL and Neo4J, but you can modify [00-config.sh](databases%2F00-config.sh) to select different databases based on your needs
|
79 |
```bash
|
80 |
bash ./databases/02-install-database.sh
|
81 |
```
|
82 |
|
83 |
-
|
84 |
-
especially if this is the first time running the script as Kubernetes needs to pull container images from registries.
|
85 |
-
You can monitor the progress using the following commands:
|
86 |
```bash
|
87 |
kubectl get clusters -n rag
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
Initially, you might see pods in `ContainerCreating` or `Pending` status - this is normal while images are being pulled and containers are starting up.
|
94 |
-
Wait until all pods show `Running` status:
|
95 |
-
```bash
|
96 |
kubectl get po -n rag
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
pg-cluster-postgresql-
|
|
|
101 |
```
|
102 |
|
103 |
### 2. Install LightRAG
|
104 |
|
105 |
LightRAG and its databases are deployed within the same Kubernetes cluster, making configuration straightforward.
|
106 |
-
|
107 |
|
108 |
-
You only need to run [install_lightrag.sh](install_lightrag.sh) like this:
|
109 |
```bash
|
110 |
export OPENAI_API_BASE=<YOUR_OPENAI_API_BASE>
|
111 |
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
|
112 |
bash ./install_lightrag.sh
|
113 |
```
|
114 |
|
115 |
-
|
116 |
|
117 |
-
After deployment, you can access the application:
|
118 |
```bash
|
119 |
-
|
120 |
-
|
121 |
|
122 |
-
|
123 |
-
|
124 |
```
|
125 |
|
126 |
## Configuration
|
@@ -187,5 +185,5 @@ env:
|
|
187 |
- Ensure all necessary environment variables (API keys and database passwords) are set before deployment
|
188 |
- For security reasons, it's recommended to pass sensitive information using environment variables rather than writing them directly in scripts or values files
|
189 |
- Lightweight deployment is suitable for testing and small-scale usage, but data persistence and performance may be limited
|
190 |
-
-
|
191 |
- For more customized configurations, please refer to the official LightRAG documentation
|
|
|
4 |
|
5 |
There are two recommended deployment methods for LightRAG:
|
6 |
1. **Lightweight Deployment**: Using built-in lightweight storage, suitable for testing and small-scale usage
|
7 |
+
2. **Production Deployment**: Using external databases (such as PostgreSQL and Neo4J), suitable for production environments and large-scale usage
|
8 |
|
9 |
## Prerequisites
|
10 |
|
|
|
16 |
* Any standard cloud or on-premises Kubernetes cluster (EKS, GKE, AKS, etc.) also works.
|
17 |
|
18 |
* **kubectl**
|
19 |
+
* The Kubernetes command-line tool for managing your cluster.
|
20 |
* Follow the official guide: [Install and Set Up kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl).
|
21 |
|
22 |
* **Helm** (v3.x+)
|
23 |
+
* Kubernetes package manager used to install LightRAG.
|
24 |
* Install it via the official instructions: [Installing Helm](https://helm.sh/docs/intro/install/).
|
25 |
|
|
|
26 |
## Lightweight Deployment (No External Databases Required)
|
27 |
|
28 |
+
This deployment option uses built-in lightweight storage components that are perfect for testing, demos, or small-scale usage scenarios. No external database configuration is required.
|
29 |
+
|
30 |
+
You can deploy LightRAG using either the provided convenience script or direct Helm commands. Both methods configure the same environment variables defined in the `lightrag/values.yaml` file.
|
31 |
+
|
32 |
+
### Using the convenience script (recommended):
|
33 |
+
|
34 |
+
```bash
|
35 |
+
export OPENAI_API_BASE=<YOUR_OPENAI_API_BASE>
|
36 |
+
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
|
37 |
+
bash ./install_lightrag_dev.sh
|
38 |
+
```
|
39 |
+
|
40 |
+
### Or using Helm directly:
|
41 |
|
42 |
```bash
|
43 |
+
# You can override any env param you want
|
44 |
helm upgrade --install lightrag ./lightrag \
|
45 |
--namespace rag \
|
46 |
--set-string env.LIGHTRAG_KV_STORAGE=JsonKVStorage \
|
|
|
57 |
--set-string env.EMBEDDING_BINDING_API_KEY=$OPENAI_API_KEY
|
58 |
```
|
59 |
|
60 |
+
### Accessing the application:
|
61 |
|
|
|
62 |
```bash
|
63 |
+
# 1. Run this port-forward command in your terminal:
|
64 |
+
kubectl --namespace rag port-forward svc/lightrag-dev 9621:9621
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
+
# 2. While the command is running, open your browser and navigate to:
|
67 |
+
# http://localhost:9621
|
68 |
```
|
69 |
|
70 |
+
## Production Deployment (Using External Databases)
|
71 |
|
72 |
### 1. Install Databases
|
73 |
> You can skip this step if you've already prepared databases. Detailed information can be found in: [README.md](databases%2FREADME.md).
|
74 |
|
75 |
We recommend KubeBlocks for database deployment. KubeBlocks is a cloud-native database operator that makes it easy to run any database on Kubernetes at production scale.
|
|
|
76 |
|
77 |
First, install KubeBlocks and KubeBlocks-Addons (skip if already installed):
|
78 |
```bash
|
79 |
bash ./databases/01-prepare.sh
|
80 |
```
|
81 |
|
82 |
+
Then install the required databases. By default, this will install PostgreSQL and Neo4J, but you can modify [00-config.sh](databases%2F00-config.sh) to select different databases based on your needs:
|
83 |
```bash
|
84 |
bash ./databases/02-install-database.sh
|
85 |
```
|
86 |
|
87 |
+
Verify that the clusters are up and running:
|
|
|
|
|
88 |
```bash
|
89 |
kubectl get clusters -n rag
|
90 |
+
# Expected output:
|
91 |
+
# NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
|
92 |
+
# neo4j-cluster Delete Running 39s
|
93 |
+
# pg-cluster postgresql Delete Running 42s
|
94 |
+
|
|
|
|
|
|
|
95 |
kubectl get po -n rag
|
96 |
+
# Expected output:
|
97 |
+
# NAME READY STATUS RESTARTS AGE
|
98 |
+
# neo4j-cluster-neo4j-0 1/1 Running 0 58s
|
99 |
+
# pg-cluster-postgresql-0 4/4 Running 0 59s
|
100 |
+
# pg-cluster-postgresql-1 4/4 Running 0 59s
|
101 |
```
|
102 |
|
103 |
### 2. Install LightRAG
|
104 |
|
105 |
LightRAG and its databases are deployed within the same Kubernetes cluster, making configuration straightforward.
|
106 |
+
The installation script automatically retrieves all database connection information from KubeBlocks, eliminating the need to manually set database credentials:
|
107 |
|
|
|
108 |
```bash
|
109 |
export OPENAI_API_BASE=<YOUR_OPENAI_API_BASE>
|
110 |
export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
|
111 |
bash ./install_lightrag.sh
|
112 |
```
|
113 |
|
114 |
+
### Accessing the application:
|
115 |
|
|
|
116 |
```bash
|
117 |
+
# 1. Run this port-forward command in your terminal:
|
118 |
+
kubectl --namespace rag port-forward svc/lightrag 9621:9621
|
119 |
|
120 |
+
# 2. While the command is running, open your browser and navigate to:
|
121 |
+
# http://localhost:9621
|
122 |
```
|
123 |
|
124 |
## Configuration
|
|
|
185 |
- Ensure all necessary environment variables (API keys and database passwords) are set before deployment
|
186 |
- For security reasons, it's recommended to pass sensitive information using environment variables rather than writing them directly in scripts or values files
|
187 |
- Lightweight deployment is suitable for testing and small-scale usage, but data persistence and performance may be limited
|
188 |
+
- Production deployment (PostgreSQL + Neo4J) is recommended for production environments and large-scale usage
|
189 |
- For more customized configurations, please refer to the official LightRAG documentation
|