Skip to content

Commit 50903c1

Browse files
authored
Merge dev into master
2 parents 276dac8 + 2f76db7 commit 50903c1

File tree

8 files changed

+316
-1
lines changed

8 files changed

+316
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
*.txt
66
*.rdb
77
*.DS_Store
8-
*cache
8+
*cache
9+
*argo*
10+
*helm*

k8s/backend.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: backend
5+
namespace: llm-backend
6+
# annotations:
7+
# argocd-image-updater.argoproj.io/image-list: backend=ghcr.io/my-org/backend:latest
8+
# argocd-image-updater.argoproj.io/write-back-method: git
9+
spec:
10+
replicas: 2
11+
selector:
12+
matchLabels:
13+
app: backend
14+
template:
15+
metadata:
16+
labels:
17+
app: backend
18+
spec:
19+
containers:
20+
- name: backend
21+
image: gaurav00700/llm_app-backend:latest
22+
# imagePullPolicy: Always # Always pulls the latest image when the pod restarts
23+
ports:
24+
- containerPort: 8000
25+
env:
26+
- name: LLM_NAME
27+
valueFrom:
28+
configMapKeyRef:
29+
name: llm-config
30+
key: LLM_NAME
31+
- name: LLM_HOST_NAME
32+
value: "llm.llm-model.svc.cluster.local" # <service-name>.<namespace>.svc.cluster.local
33+
- name: LLM_PORT
34+
value: "11434"
35+
- name: REDIS_HOST_NAME
36+
value: "redis.llm-redis.svc.cluster.local" # <service-name>.<namespace>.svc.cluster.local
37+
- name: REDIS_PORT
38+
value: "6379"
39+
volumeMounts:
40+
- mountPath: /workdir/data
41+
name: data-volume
42+
volumes: # Call the volume mount
43+
- name: data-volume
44+
persistentVolumeClaim:
45+
claimName: data-pvc
46+
47+
---
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: backend
52+
namespace: llm-backend
53+
spec:
54+
type: ClusterIP
55+
selector:
56+
app: backend
57+
ports:
58+
- protocol: TCP
59+
port: 8000
60+
targetPort: 8000

k8s/configmap.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: llm-config
5+
namespace: llm-backend
6+
data:
7+
LLM_NAME: "qwen2.5:0.5b"
8+
9+
---
10+
apiVersion: v1
11+
kind: ConfigMap
12+
metadata:
13+
name: llm-config
14+
namespace: llm-model
15+
data:
16+
LLM_NAME: "qwen2.5:0.5b"

k8s/frontend.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: frontend # service name
5+
namespace: llm-frontend # namespace name
6+
# annotations:
7+
# argocd-image-updater.argoproj.io/image-list: frontend=ghcr.io/my-org/frontend:latest
8+
# argocd-image-updater.argoproj.io/write-back-method: git
9+
spec:
10+
replicas: 2
11+
selector:
12+
matchLabels:
13+
app: frontend
14+
template:
15+
metadata:
16+
labels:
17+
app: frontend
18+
spec:
19+
containers:
20+
- name: frontend
21+
image: gaurav00700/llm_app-frontend:latest
22+
# imagePullPolicy: Always # Always pulls the latest image when the pod restarts
23+
ports:
24+
- containerPort: 8500
25+
env:
26+
- name: BACKEND_ENDPNT
27+
value: "http://backend.llm-backend.svc.cluster.local:8000/ask"
28+
volumeMounts:
29+
- mountPath: /workdir/data
30+
name: data-volume
31+
volumes: # Call the volume mount
32+
- name: data-volume
33+
persistentVolumeClaim:
34+
claimName: data-pvc # Matches PVC name in the same namespace
35+
36+
---
37+
apiVersion: v1
38+
kind: Service
39+
metadata:
40+
name: frontend
41+
namespace: llm-frontend
42+
spec:
43+
type: LoadBalancer
44+
selector:
45+
app: frontend
46+
ports:
47+
- protocol: TCP
48+
port: 8500 # host port
49+
targetPort: 8500 # pod port

k8s/model.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: llm
5+
namespace: llm-model
6+
# annotations:
7+
# argocd-image-updater.argoproj.io/image-list: model=ghcr.io/my-org/model:latest
8+
# argocd-image-updater.argoproj.io/write-back-method: git
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
app: llm
14+
template:
15+
metadata:
16+
labels:
17+
app: llm
18+
spec:
19+
containers:
20+
- name: llm
21+
image: gaurav00700/llm_app-llm:latest
22+
# imagePullPolicy: Always # Always pulls the latest image when the pod restarts
23+
ports:
24+
- containerPort: 11434
25+
env:
26+
- name: LLM_NAME
27+
valueFrom:
28+
configMapKeyRef:
29+
name: llm-config
30+
key: LLM_NAME
31+
volumeMounts:
32+
- mountPath: /root/.ollama
33+
name: llm-volume
34+
resources:
35+
limits:
36+
nvidia.com/gpu: 1 # GPU qty
37+
volumes: # Call the volume mount
38+
- name: llm-volume
39+
persistentVolumeClaim:
40+
claimName: llm-pvc
41+
42+
---
43+
apiVersion: v1
44+
kind: Service
45+
metadata:
46+
name: llm
47+
namespace: llm-model
48+
spec:
49+
type: ClusterIP
50+
selector:
51+
app: llm
52+
ports:
53+
- protocol: TCP
54+
port: 11434
55+
targetPort: 11434

k8s/namespaces.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: llm-frontend
5+
6+
---
7+
apiVersion: v1
8+
kind: Namespace
9+
metadata:
10+
name: llm-backend
11+
12+
---
13+
apiVersion: v1
14+
kind: Namespace
15+
metadata:
16+
name: llm-redis
17+
18+
---
19+
apiVersion: v1
20+
kind: Namespace
21+
metadata:
22+
name: llm-model

k8s/redis.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: redis
5+
namespace: llm-redis
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: redis
11+
template:
12+
metadata:
13+
labels:
14+
app: redis
15+
spec:
16+
containers:
17+
- name: redis
18+
image: redis:latest
19+
# imagePullPolicy: Always # Always pulls the latest image when the pod restarts
20+
ports:
21+
- containerPort: 6379
22+
volumeMounts:
23+
- mountPath: /data
24+
name: redis-volume
25+
volumes: # Call the volume mount
26+
- name: redis-volume
27+
persistentVolumeClaim:
28+
claimName: redis-pvc
29+
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: redis
35+
namespace: llm-redis
36+
spec:
37+
type: ClusterIP
38+
selector:
39+
app: redis
40+
ports:
41+
- protocol: TCP
42+
port: 6379
43+
targetPort: 6379

k8s/volumes.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: v1
2+
kind: PersistentVolume
3+
metadata:
4+
name: shared-pv
5+
spec:
6+
capacity:
7+
storage: 5Gi
8+
accessModes:
9+
- ReadWriteOnce # Allow multiple pods to read/write [ReadWriteMany, ReadWriteOnce]
10+
persistentVolumeReclaimPolicy: Retain # Data remains after PVC deletion
11+
hostPath:
12+
path: "/data" # Must match the mounted path inside Minikube
13+
14+
---
15+
apiVersion: v1
16+
kind: PersistentVolumeClaim
17+
metadata:
18+
name: data-pvc
19+
namespace: llm-frontend
20+
spec:
21+
accessModes:
22+
- ReadWriteOnce # Allow multiple pods to read/write [ReadWriteMany, ReadWriteOnce]
23+
resources:
24+
requests:
25+
storage: 100Mi # Gi, Mi
26+
# volumeName: shared-pv # binds to PV
27+
# storageClassName: "" # Manually created PV, so no storage class
28+
29+
---
30+
apiVersion: v1
31+
kind: PersistentVolumeClaim
32+
metadata:
33+
name: data-pvc
34+
namespace: llm-backend
35+
spec:
36+
accessModes:
37+
- ReadWriteOnce
38+
resources:
39+
requests:
40+
storage: 100Mi
41+
# volumeName: shared-pv # binds to PV
42+
# storageClassName: "" # Must be empty to use a manually created PV
43+
44+
---
45+
apiVersion: v1
46+
kind: PersistentVolumeClaim
47+
metadata:
48+
name: redis-pvc
49+
namespace: llm-redis
50+
spec:
51+
accessModes:
52+
- ReadWriteMany
53+
resources:
54+
requests:
55+
storage: 100Mi
56+
57+
---
58+
apiVersion: v1
59+
kind: PersistentVolumeClaim
60+
metadata:
61+
name: llm-pvc
62+
namespace: llm-model
63+
spec:
64+
accessModes:
65+
- ReadWriteMany
66+
resources:
67+
requests:
68+
storage: 5Gi

0 commit comments

Comments
 (0)