apiVersion: apps/v1 kind: Deployment metadata: name: ollama-fallback namespace: open-webui spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: ollama-fallback template: metadata: labels: app: ollama-fallback spec: # Pin the pod strictly to Node 3 nodeSelector: kubernetes.io/hostname: nst-node-3 containers: - name: ollama # THE BOOT FIX: Using a frozen tag allows local caching, bypassing the 8-minute pull image: ollama/ollama:0.5.4 imagePullPolicy: IfNotPresent # THE FIX: Injects environment variables to pin the model in RAM permanently env: - name: OLLAMA_KEEP_ALIVE value: "-1" # THE SPEED FIX: Forces the calculations to fit perfectly onto your hardware threads - name: OLLAMA_NUM_THREADS value: "4" ports: - containerPort: 11434 name: ollama-http resources: # Matching limits and requests perfectly eliminates CPU scheduling wait loops requests: memory: "2Gi" cpu: "4" # Guarantee 4 physical cores limits: memory: "4Gi" cpu: "4" # Perfectly matches the 4 execution threads above volumeMounts: - name: local-model-storage mountPath: /root/.ollama volumes: # THE FIX: Bypasses Longhorn replication entirely - name: local-model-storage hostPath: path: /var/lib/ollama-models type: DirectoryOrCreate --- apiVersion: v1 kind: Service metadata: name: ollama-fallback-service namespace: open-webui spec: selector: app: ollama-fallback ports: - protocol: TCP port: 11434 targetPort: 11434