@@ -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,62 @@ 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+ If you are using Vertex AI, make a secret for authentication:
97+ ``` bash
98+ kubectl create secret generic gcloud-credentials \
99+ --from-file=application_default_credentials.json=$HOME /.config/gcloud/application_default_credentials.json
100+ ```
101+
102+ Now that your configuration is applied, create the chatbot-rag-app deployment
103+ and service by applying this manifest:
104+ ``` bash
105+ kubectl apply -f k8s-manifest.yml
106+ ```
107+
108+ Next, block until chatbot-rag-app is available.
109+ ``` bash
110+ kubectl wait --for=condition=available --timeout=20m deployment/chatbot-rag-app
111+ ```
112+
113+ * Note* : The first run may take several minutes to become available. Here's how
114+ to follow logs on this stage:
115+ ``` bash
116+ kubectl logs deployment.apps/chatbot-rag-app -c create-index -f
117+ ```
118+
119+ Next, forward the kibana port:
120+ ``` bash
121+ kubectl port-forward service/kibana 5601:5601 &
122+ ```
123+
124+ Clean up when finished, like this:
125+
126+ ``` bash
127+ kubectl delete -f k8s-manifest.yml
128+ ```
129+
74130### Run with Python
75131
76132If you want to run this example with Python, you need to do a few things listed
@@ -196,3 +252,5 @@ docker compose up --build --force-recreate
196252---
197253[ loader-docs ] : https://python.langchain.com/docs/how_to/#document-loaders
198254[ install-es ] : https://www.elastic.co/search-labs/tutorials/install-elasticsearch
255+ [ docker-compose-elastic ] : ../../docker/docker-compose-elastic.yml
256+ [ k8s-manifest-elastic ] : ../../k8s/k8s-manifest-elastic.yml
0 commit comments