cluster-manifests/open-webui/open-webui-stack.yaml

117 lines
2.7 KiB
YAML

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: openwebui-db
namespace: open-webui
spec:
instances: 1
imageName: ghcr.io/cloudnative-pg/postgresql:16
bootstrap:
initdb:
database: openwebui
owner: webui_admin
storage:
size: 10Gi
storageClass: longhorn
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: open-webui
namespace: open-webui
spec:
replicas: 1
revisionHistoryLimit: 5
selector:
matchLabels:
app: open-webui
strategy:
type: Recreate
template:
metadata:
labels:
app: open-webui
spec:
containers:
- name: open-webui
image: ghcr.io/open-webui/open-webui:main
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
# THE POSTGRES ROUTE: Connects your Python app directly to the CNPG cluster
- name: DATABASE_URL
value: "postgresql://webui_admin:$(password)@openwebui-db-rw:5432/openwebui"
# CORE CAPABILITIES: Kept completely stock to support your fallback and LM Studio
- name: ENABLE_OLLAMA_API
value: "True"
- name: ENABLE_OPENAI_API
value: "True"
- name: WEBUI_SECRET_KEY
value: "5e7fb9706cbd8137baf6299a6e6af6297ae03c6bfe4a6edb"
envFrom:
- secretRef:
name: openwebui-db-app
volumeMounts:
- mountPath: /app/backend/data
name: webui-data
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2"
# THE FIXED DNS LOGIC: Allows the container to see internal cluster service maps natively
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- name: webui-data
persistentVolumeClaim:
claimName: open-webui-pvc
---
apiVersion: v1
kind: Service
metadata:
name: open-webui-service
namespace: open-webui
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8080
selector:
app: open-webui
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: openwebui-local-ingress
namespace: open-webui
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
ingressClassName: nginx
tls:
- secretName: openwebui-tls-secret
hosts:
- ai.needlestack.boo
rules:
- host: ai.needlestack.boo
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: open-webui-service
port:
number: 80