add ai workloads
This commit is contained in:
parent
6cbf60a728
commit
dec0f4c86c
13 changed files with 407 additions and 0 deletions
11
kubernetes/apps/ai/kustomization.yaml
Normal file
11
kubernetes/apps/ai/kustomization.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
# Pre Flux-Kustomizations
|
||||||
|
- ./namespace.yaml
|
||||||
|
# Flux-Kustomizations
|
||||||
|
- ./ollama/ks.yaml
|
||||||
|
- ./open-webui/ks.yaml
|
||||||
|
- ./stable-diffusion/ks.yaml
|
8
kubernetes/apps/ai/namespace.yaml
Normal file
8
kubernetes/apps/ai/namespace.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: ai
|
||||||
|
labels:
|
||||||
|
kustomize.toolkit.fluxcd.io/prune: disabled
|
||||||
|
volsync.backube/privileged-movers: "true"
|
88
kubernetes/apps/ai/ollama/app/helmrelease.yaml
Normal file
88
kubernetes/apps/ai/ollama/app/helmrelease.yaml
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: &app ollama
|
||||||
|
spec:
|
||||||
|
interval: 30m
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: app-template
|
||||||
|
version: 3.4.0
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: bjw-s
|
||||||
|
namespace: flux-system
|
||||||
|
install:
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
upgrade:
|
||||||
|
cleanupOnFail: true
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
strategy: rollback
|
||||||
|
values:
|
||||||
|
controllers:
|
||||||
|
ollama:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
pod:
|
||||||
|
nodeSelector:
|
||||||
|
nvidia.com/gpu.present: "true"
|
||||||
|
runtimeClassName: nvidia
|
||||||
|
containers:
|
||||||
|
app:
|
||||||
|
image:
|
||||||
|
repository: docker.io/ollama/ollama
|
||||||
|
tag: 0.3.8
|
||||||
|
env:
|
||||||
|
- name: OLLAMA_HOST
|
||||||
|
value: 0.0.0.0
|
||||||
|
- name: OLLAMA_ORIGINS
|
||||||
|
value: "*"
|
||||||
|
- name: OLLAMA_MODELS
|
||||||
|
value: &modelPath "/models"
|
||||||
|
- name: OLLAMA_KEEP_ALIVE
|
||||||
|
value: "24h"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
nvidia.com/gpu: 1 # requesting 1 GPU
|
||||||
|
cpu: 500m
|
||||||
|
memory: 2Gi
|
||||||
|
limits:
|
||||||
|
memory: 16Gi
|
||||||
|
nvidia.com/gpu: 1 # requesting 1 GPU
|
||||||
|
service:
|
||||||
|
app:
|
||||||
|
controller: ollama
|
||||||
|
ports:
|
||||||
|
http:
|
||||||
|
port: 11434
|
||||||
|
ingress:
|
||||||
|
app:
|
||||||
|
enabled: true
|
||||||
|
className: internal-nginx
|
||||||
|
hosts:
|
||||||
|
- host: &host "{{ .Release.Name }}.jahanson.tech"
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
service:
|
||||||
|
identifier: app
|
||||||
|
port: http
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- *host
|
||||||
|
persistence:
|
||||||
|
models:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: ollama-models
|
||||||
|
advancedMounts:
|
||||||
|
ollama:
|
||||||
|
app:
|
||||||
|
- path: *modelPath
|
||||||
|
config:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: ollama
|
||||||
|
globalMounts:
|
||||||
|
- path: /root/.ollama
|
8
kubernetes/apps/ai/ollama/app/kustomization.yaml
Normal file
8
kubernetes/apps/ai/ollama/app/kustomization.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./helmrelease.yaml
|
||||||
|
- ./pvc.yaml
|
||||||
|
- ../../../../templates/volsync
|
12
kubernetes/apps/ai/ollama/app/pvc.yaml
Normal file
12
kubernetes/apps/ai/ollama/app/pvc.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: ollama-models
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Gi
|
||||||
|
storageClassName: openebs-hostpath
|
32
kubernetes/apps/ai/ollama/ks.yaml
Normal file
32
kubernetes/apps/ai/ollama/ks.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: &app ollama
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
targetNamespace: ai
|
||||||
|
commonMetadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: *app
|
||||||
|
dependsOn:
|
||||||
|
- name: nvidia-device-plugin
|
||||||
|
- name: node-feature-discovery
|
||||||
|
- name: volsync
|
||||||
|
- name: openebs
|
||||||
|
path: ./kubernetes/apps/ai/ollama/app
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: theshire
|
||||||
|
wait: false
|
||||||
|
interval: 30m
|
||||||
|
retryInterval: 1m
|
||||||
|
timeout: 5m
|
||||||
|
postBuild:
|
||||||
|
substitute:
|
||||||
|
APP: *app
|
||||||
|
VOLSYNC_CAPACITY: 1Gi
|
||||||
|
VOLSYNC_STORAGECLASS: openebs-zfs
|
||||||
|
VOLSYNC_SNAPSHOTCLASS: openebs-zfs
|
77
kubernetes/apps/ai/open-webui/app/helmrelease.yaml
Normal file
77
kubernetes/apps/ai/open-webui/app/helmrelease.yaml
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: &app open-webui
|
||||||
|
spec:
|
||||||
|
interval: 30m
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: app-template
|
||||||
|
version: 3.4.0
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: bjw-s
|
||||||
|
namespace: flux-system
|
||||||
|
dependsOn:
|
||||||
|
- name: ollama
|
||||||
|
install:
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
upgrade:
|
||||||
|
cleanupOnFail: true
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
strategy: rollback
|
||||||
|
values:
|
||||||
|
controllers:
|
||||||
|
open-webui:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
containers:
|
||||||
|
app:
|
||||||
|
image:
|
||||||
|
repository: ghcr.io/open-webui/open-webui
|
||||||
|
tag: v0.3.16
|
||||||
|
env:
|
||||||
|
- name: OLLAMA_BASE_URL
|
||||||
|
value: http://ollama.ai.svc.cluster.local:11434
|
||||||
|
- name: ENABLE_RAG_WEB_SEARCH
|
||||||
|
value: true
|
||||||
|
- name: RAG_WEB_SEARCH_ENGINE
|
||||||
|
value: searxng
|
||||||
|
- name: SEARXNG_QUERY_URL
|
||||||
|
value: http://searxng.default.svc.cluster.local:8080/search?q=<query>
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 2Gi
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
service:
|
||||||
|
app:
|
||||||
|
controller: open-webui
|
||||||
|
ports:
|
||||||
|
http:
|
||||||
|
port: 8080
|
||||||
|
ingress:
|
||||||
|
app:
|
||||||
|
enabled: true
|
||||||
|
className: internal-nginx
|
||||||
|
hosts:
|
||||||
|
- host: &host "chat.jahanson.tech"
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
service:
|
||||||
|
identifier: app
|
||||||
|
port: http
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- *host
|
||||||
|
persistence:
|
||||||
|
config:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: *app
|
||||||
|
globalMounts:
|
||||||
|
- path: /app/backend/data
|
8
kubernetes/apps/ai/open-webui/app/kustomization.yaml
Normal file
8
kubernetes/apps/ai/open-webui/app/kustomization.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./helmrelease.yaml
|
||||||
|
- ../../../../templates/volsync
|
||||||
|
- ../../../../templates/gatus/internal
|
29
kubernetes/apps/ai/open-webui/ks.yaml
Normal file
29
kubernetes/apps/ai/open-webui/ks.yaml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: &app open-webui
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
targetNamespace: ai
|
||||||
|
commonMetadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: *app
|
||||||
|
dependsOn:
|
||||||
|
- name: volsync
|
||||||
|
- name: ollama
|
||||||
|
path: ./kubernetes/apps/ai/open-webui/app
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: theshire
|
||||||
|
wait: false
|
||||||
|
interval: 30m
|
||||||
|
retryInterval: 1m
|
||||||
|
timeout: 5m
|
||||||
|
postBuild:
|
||||||
|
substitute:
|
||||||
|
APP: *app
|
||||||
|
VOLSYNC_CAPACITY: 5Gi
|
||||||
|
GATUS_SUBDOMAIN: chat
|
82
kubernetes/apps/ai/stable-diffusion/comfyui/helmrelease.yaml
Normal file
82
kubernetes/apps/ai/stable-diffusion/comfyui/helmrelease.yaml
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: &app comfyui
|
||||||
|
spec:
|
||||||
|
interval: 30m
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: app-template
|
||||||
|
version: 3.4.0
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: bjw-s
|
||||||
|
namespace: flux-system
|
||||||
|
install:
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
upgrade:
|
||||||
|
cleanupOnFail: true
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
strategy: rollback
|
||||||
|
values:
|
||||||
|
controllers:
|
||||||
|
comfyui:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
pod:
|
||||||
|
nodeSelector:
|
||||||
|
nvidia.com/gpu.present: "true"
|
||||||
|
runtimeClassName: nvidia
|
||||||
|
containers:
|
||||||
|
app:
|
||||||
|
image:
|
||||||
|
repository: docker.io/jahanson/comfyui
|
||||||
|
tag: v0.0.1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
nvidia.com/gpu: 1 # requesting 1 GPU
|
||||||
|
cpu: 500m
|
||||||
|
memory: 2Gi
|
||||||
|
limits:
|
||||||
|
memory: 60Gi
|
||||||
|
nvidia.com/gpu: 1 # requesting 1 GPU
|
||||||
|
service:
|
||||||
|
app:
|
||||||
|
controller: comfyui
|
||||||
|
ports:
|
||||||
|
http:
|
||||||
|
port: 7860
|
||||||
|
ingress:
|
||||||
|
app:
|
||||||
|
enabled: true
|
||||||
|
className: internal-nginx
|
||||||
|
hosts:
|
||||||
|
- host: &host "{{ .Release.Name }}.jahanson.tech"
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
service:
|
||||||
|
identifier: app
|
||||||
|
port: http
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- *host
|
||||||
|
persistence:
|
||||||
|
models:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: stablediffusion-checkpoints
|
||||||
|
globalMounts:
|
||||||
|
- path: /data/models
|
||||||
|
config:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: comfyui
|
||||||
|
globalMounts:
|
||||||
|
- path: /data/config
|
||||||
|
output:
|
||||||
|
enabled: true
|
||||||
|
type: emptyDir
|
||||||
|
globalMounts:
|
||||||
|
- path: /output
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./helmrelease.yaml
|
||||||
|
- ./pvc.yaml
|
||||||
|
- ../../../../templates/volsync
|
||||||
|
- ../../../../templates/gatus/internal
|
12
kubernetes/apps/ai/stable-diffusion/comfyui/pvc.yaml
Normal file
12
kubernetes/apps/ai/stable-diffusion/comfyui/pvc.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: stablediffusion-checkpoints
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 300Gi
|
||||||
|
storageClassName: openebs-hostpath
|
31
kubernetes/apps/ai/stable-diffusion/ks.yaml
Normal file
31
kubernetes/apps/ai/stable-diffusion/ks.yaml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: &app comfyui
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
targetNamespace: ai
|
||||||
|
commonMetadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: *app
|
||||||
|
dependsOn:
|
||||||
|
- name: nvidia-device-plugin
|
||||||
|
- name: node-feature-discovery
|
||||||
|
- name: volsync
|
||||||
|
- name: rook-ceph-cluster
|
||||||
|
path: ./kubernetes/apps/ai/stable-diffusion/comfyui
|
||||||
|
prune: true
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: theshire
|
||||||
|
wait: false
|
||||||
|
interval: 30m
|
||||||
|
retryInterval: 1m
|
||||||
|
timeout: 5m
|
||||||
|
postBuild:
|
||||||
|
substitute:
|
||||||
|
APP: *app
|
||||||
|
VOLSYNC_CAPACITY: 5Gi
|
||||||
|
GATUS_SUBDOMAIN: comfyui
|
Loading…
Reference in a new issue