@@ -22,8 +22,8 @@ Copy [env.example](env.example) to `.env` and fill in values noted inside.
2222## Installing and connecting to Elasticsearch
2323
2424There are a number of ways to install Elasticsearch. Cloud is best for most
25- use-cases. We also have [ docker-compose-elastic.yml] ( ../../ docker) , that starts
26- Elasticsearch, Kibana, and APM Server on your laptop with one command .
25+ use-cases. We also have [ docker-compose-elastic.yml] [ docker-compose-elastic ] ,
26+ that starts Elasticsearch, Kibana, and APM Server on your laptop in one step .
2727
2828Once you decided your approach, edit your ` .env ` file accordingly.
2929
@@ -71,6 +71,69 @@ Clean up when finished, like this:
7171docker compose down
7272```
7373
74+ ### Run with Kubernetes
75+
76+ Kubernetes is more complicated than Docker, but closer to the production
77+ experience for many users. [ k8s-manifest.yml] ( k8s-manifest.yml ) creates the
78+ same services, but needs additional configuration first.
79+
80+ First step is to setup your environment. [ env.example] ( env.example ) must be
81+ copied to a file name ` .env ` and updated with ` ELASTICSEARCH_URL ` and
82+ ` OTEL_EXPORTER_OTLP_ENDPOINT ` values visible to you Kubernetes deployment.
83+
84+ For example, if you started your Elastic Stack with [ k8s-manifest-elastic.yml] [ k8s-manifest-elastic ] ,
85+ you would update these values:
86+ ```
87+ ELASTICSEARCH_URL=http://elasticsearch:9200
88+ OTEL_EXPORTER_OTLP_ENDPOINT=http://apm-server:8200
89+ ```
90+
91+ Then, import your ` .env ` file as a configmap like this:
92+ ``` bash
93+ kubectl create configmap chatbot-rag-app-env --from-env-file=.env
94+ ```
95+
96+ <details >
97+ <summary >To use Vertex AI, set `LLM_TYPE=vertex` in your `.env` and follow these steps</summary >
98+
99+ The ` api-frontend container ` needs access to your Google Cloud credentials.
100+ Share your ` application_default_credentials.json ` as a Kubernetes secret:
101+ ``` bash
102+ # Logs you into Google Cloud and creates application_default_credentials.json
103+ gcloud auth application-default login
104+ # Adds your credentials to a Kubernetes secret named gcloud-credentials
105+ kubectl create secret generic gcloud-credentials \
106+ --from-file=application_default_credentials.json=$HOME /.config/gcloud/application_default_credentials.json
107+ ```
108+ </details >
109+
110+ Now that your configuration is applied, create the ` chatbot-rag-app ` deployment
111+ and service by applying this manifest:
112+ ``` bash
113+ kubectl apply -f k8s-manifest.yml
114+ ```
115+
116+ Next, block until ` chatbot-rag-app ` is available.
117+ ``` bash
118+ kubectl wait --for=condition=available --timeout=20m deployment/chatbot-rag-app
119+ ```
120+
121+ * Note* : The first run may take several minutes to become available. Here's how
122+ to follow logs on this stage:
123+ ``` bash
124+ kubectl logs deployment.apps/chatbot-rag-app -c create-index -f
125+ ```
126+
127+ Next, forward the web UI port:
128+ ``` bash
129+ kubectl port-forward deployment.apps/chatbot-rag-app 4000:4000 &
130+ ```
131+
132+ Clean up when finished, like this:
133+ ``` bash
134+ kubectl delete -f k8s-manifest.yml
135+ ```
136+
74137### Run with Python
75138
76139If you want to run this example with Python, you need to do a few things listed
@@ -165,8 +228,6 @@ pip-compile
165228pip install -r requirements.txt
166229# Add opentelemetry instrumentation for these dependencies
167230edot-bootstrap >> requirements.txt
168- # Missing dependency for langtrace vertexai instrumentation
169- echo " setuptools" >> requirements.txt
170231# Install opentelemetry dependencies
171232pip install -r requirements.txt
172233```
@@ -198,3 +259,5 @@ docker compose up --build --force-recreate
198259---
199260[ loader-docs ] : https://python.langchain.com/docs/how_to/#document-loaders
200261[ install-es ] : https://www.elastic.co/search-labs/tutorials/install-elasticsearch
262+ [ docker-compose-elastic ] : ../../docker/docker-compose-elastic.yml
263+ [ k8s-manifest-elastic ] : ../../k8s/k8s-manifest-elastic.yml
0 commit comments