split ollama deployment to files

This commit is contained in:
2025-04-05 22:08:02 +02:00
parent 8ad179c72f
commit 9a9c1a45db
7 changed files with 165 additions and 158 deletions

View File

@@ -0,0 +1,66 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ollama-proxy
namespace: ollama
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: ollama-proxy
template:
metadata:
labels:
app.kubernetes.io/name: ollama-proxy
spec:
containers:
- name: caddy
image: caddy:2.9.1-alpine
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /etc/caddy
name: proxy-config
env:
- name: API_KEY
valueFrom:
secretKeyRef:
name: ollama-api-key
key: API_KEY
volumes:
- name: proxy-config
configMap:
name: ollama-proxy-config
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: ollama
name: ollama-proxy-config
data:
Caddyfile: |
http://ollama.lumpiasty.xyz {
@requireAuth {
not header Authorization "Bearer {env.API_KEY}"
}
respond @requireAuth "Unauthorized" 401
reverse_proxy ollama:11434
}
---
apiVersion: v1
kind: Service
metadata:
namespace: ollama
name: ollama-proxy
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: ollama-proxy
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP