play with containerized llms

This commit is contained in:
Remy Moll 2024-09-30 15:22:01 +02:00
parent b81eee425e
commit cb0766fde2
7 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama-rocm
spec:
replicas: 1
selector:
matchLabels:
app: ollama-rocm
template:
metadata:
labels:
app: ollama-rocm
spec:
nodeSelector:
gpu: full
containers:
- name: ollama
image: ollama
env:
- name: HSA_OVERRIDE_GFX_VERSION
# allows to run on IGPU as well
value: "11.0.0"
ports:
- containerPort: 11434
name: ollama
volumeMounts:
- name: ollama-data
mountPath: /root/.ollama
- name: dshm
mountPath: /dev/shm
- name: dri
mountPath: /dev/dri/
- name: kfd
mountPath: /dev/kfd
resources:
requests:
memory: "1Gi"
cpu: "1"
limits:
memory: "16Gi"
cpu: "8"
volumes:
- name: ollama-data
emptyDir: {}
- name: dri
hostPath:
path: /dev/dri/
- name: dshm
emptyDir:
medium: Memory
- name: kfd
hostPath: /dev/kfd

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: ollama-service
spec:
selector:
app: ollama-rocm
ports:
- protocol: TCP
port: 11434
targetPort: 11434
name: ollama

View File

@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama-ui
labels:
app: ollama-ui
spec:
replicas: 1
selector:
matchLabels:
app: ollama-ui
template:
metadata:
labels:
app: ollama-ui
spec:
containers:
- name: ollama-ui
image: ollama-ui
ports:
- containerPort: 8080
env:
- name: OLLAMA_BASE_URL
value: http://ollama-service:11434
volumeMounts:
- name: ollama-ui-data
mountPath: /app/backend/data
volumes:
- name: ollama-ui-data
emptyDir: {}

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: ollama-ui-service
spec:
selector:
app: ollama-ui
ports:
- protocol: TCP
port: 8080
targetPort: 8080
name: ollama-ui

21
apps/ollama/ingress.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: ollama-ingressroute
spec:
entryPoints:
- websecure
routes:
- match: Host(`llm.kluster.moll.re`)
kind: Rule
services:
- name: ollama-ui-service
port: 8080
# - match: Host(`todos.kluster.moll.re`) && PathPrefix(`/`)
# kind: Rule
# services:
# - name: todos-frontend
# port: 80
tls:
certResolver: default-tls

View File

@ -0,0 +1,23 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: ollama
resources:
- namespace.yaml
- backend.deployment.yaml
- backend.service.yaml
- frontend.deployment.yaml
- frontend.service.yaml
- ingress.yaml
images:
- name: ollama
newName: ollama/ollama
newTag: 0.3.6-rocm
- name: ollama-ui
newName: ghcr.io/open-webui/open-webui
newTag: main

View File

@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: placeholder
labels:
pod-security.kubernetes.io/enforce: privileged