-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathk8s-manifest.yml
58 lines (58 loc) · 1.7 KB
/
k8s-manifest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
# chatbot-rag-app deploys "create-index" to install ELSER and load values.
# Then, it starts "api-frontend" to serve the application.
apiVersion: apps/v1
kind: Deployment
metadata:
name: chatbot-rag-app
spec:
replicas: 1
selector:
matchLabels:
app: chatbot-rag-app
template:
metadata:
labels:
app: chatbot-rag-app
spec:
# For `LLM_TYPE=vertex`: create a volume for application_default_credentials.json
volumes:
- name: gcloud-credentials
secret:
secretName: gcloud-credentials
optional: true # only read when `LLM_TYPE=vertex`
initContainers:
- name: create-index
image: &image ghcr.io/elastic/elasticsearch-labs/chatbot-rag-app:latest
command: &command [ "opentelemetry-instrument" ] # match image
args: [ "flask", "create-index" ]
# This recreates your configmap based on your .env file:
# kubectl create configmap chatbot-rag-app-env --from-env-file=.env
envFrom: &envFrom
- configMapRef:
name: chatbot-rag-app-env
containers:
- name: api-frontend
image: *image
command: *command
args: [ "python", "api/app.py" ]
ports:
- containerPort: 4000
envFrom: *envFrom
# For `LLM_TYPE=vertex`: mount credentials to the path read by the google-cloud-sdk
volumeMounts:
- name: gcloud-credentials
mountPath: /root/.config/gcloud
readOnly: true
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app: chatbot-rag-app
ports:
- protocol: TCP
port: 4000
targetPort: 4000