From 9ddc57c2e2ca5e5f750f377dd610a6a26f047689 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Sivakumar Date: Wed, 15 Apr 2026 23:21:05 +0530 Subject: [PATCH] feat(ollama): add internal Ollama service with gemma3:270m in nxtgauge-ai namespace - Add namespace, PVC, deployment, service, and kustomization for Ollama - ClusterIP only (internal), no ingress - 10Gi PVC mounted at /root/.ollama - Resource limits: 700Mi-1500Mi memory, 500m-1000m CPU - Add ArgoCD Application CR for ollama - Update backend configmap with OLLAMA_BASE_URL and OLLAMA_CHAT_MODEL --- .../nxtgauge-backend-rust/base/configmap.yaml | 2 + apps/ollama/base/deployment.yaml | 40 +++++++++++++++++++ apps/ollama/base/kustomization.yaml | 7 ++++ apps/ollama/base/namespace.yaml | 4 ++ apps/ollama/base/pvc.yaml | 11 +++++ apps/ollama/base/service.yaml | 15 +++++++ argocd/ollama-application.yaml | 20 ++++++++++ 7 files changed, 99 insertions(+) create mode 100644 apps/ollama/base/deployment.yaml create mode 100644 apps/ollama/base/kustomization.yaml create mode 100644 apps/ollama/base/namespace.yaml create mode 100644 apps/ollama/base/pvc.yaml create mode 100644 apps/ollama/base/service.yaml create mode 100644 argocd/ollama-application.yaml diff --git a/apps/nxtgauge-backend-rust/base/configmap.yaml b/apps/nxtgauge-backend-rust/base/configmap.yaml index 4d34234..92dd537 100644 --- a/apps/nxtgauge-backend-rust/base/configmap.yaml +++ b/apps/nxtgauge-backend-rust/base/configmap.yaml @@ -25,3 +25,5 @@ data: CATERING_SERVICES_SERVICE_URL: "http://nxtgauge-rust-catering-services:9115" PAYMENTS_SERVICE_URL: "http://nxtgauge-rust-payments:9116" UGC_CONTENT_CREATORS_SERVICE_URL: "http://nxtgauge-rust-ugc-content-creators:9117" + OLLAMA_BASE_URL: "http://ollama.nxtgauge-ai.svc.cluster.local:11434" + OLLAMA_CHAT_MODEL: "gemma3:270m" diff --git a/apps/ollama/base/deployment.yaml b/apps/ollama/base/deployment.yaml new file mode 100644 index 0000000..c29b291 --- /dev/null +++ b/apps/ollama/base/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ollama + namespace: nxtgauge-ai + labels: + app: ollama +spec: + replicas: 1 + selector: + matchLabels: + app: ollama + template: + metadata: + labels: + app: ollama + spec: + containers: + - name: ollama + image: ollama/ollama:latest + ports: + - containerPort: 11434 + name: http + env: + - name: OLLAMA_HOST + value: "0.0.0.0:11434" + volumeMounts: + - name: ollama-models + mountPath: /root/.ollama + resources: + requests: + cpu: 500m + memory: 700Mi + limits: + cpu: 1000m + memory: 1500Mi + volumes: + - name: ollama-models + persistentVolumeClaim: + claimName: ollama-models \ No newline at end of file diff --git a/apps/ollama/base/kustomization.yaml b/apps/ollama/base/kustomization.yaml new file mode 100644 index 0000000..31d547e --- /dev/null +++ b/apps/ollama/base/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - namespace.yaml + - pvc.yaml + - deployment.yaml + - service.yaml \ No newline at end of file diff --git a/apps/ollama/base/namespace.yaml b/apps/ollama/base/namespace.yaml new file mode 100644 index 0000000..d1b515f --- /dev/null +++ b/apps/ollama/base/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: nxtgauge-ai \ No newline at end of file diff --git a/apps/ollama/base/pvc.yaml b/apps/ollama/base/pvc.yaml new file mode 100644 index 0000000..67e13e1 --- /dev/null +++ b/apps/ollama/base/pvc.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ollama-models + namespace: nxtgauge-ai +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi \ No newline at end of file diff --git a/apps/ollama/base/service.yaml b/apps/ollama/base/service.yaml new file mode 100644 index 0000000..593ef08 --- /dev/null +++ b/apps/ollama/base/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: ollama + namespace: nxtgauge-ai + labels: + app: ollama +spec: + type: ClusterIP + ports: + - port: 11434 + targetPort: 11434 + name: http + selector: + app: ollama \ No newline at end of file diff --git a/argocd/ollama-application.yaml b/argocd/ollama-application.yaml new file mode 100644 index 0000000..35805f4 --- /dev/null +++ b/argocd/ollama-application.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: ollama + namespace: argocd +spec: + destination: + namespace: nxtgauge-ai + server: https://kubernetes.default.svc + project: default + source: + path: apps/ollama/base + repoURL: https://github.com/Traceworks2023/nxtgauge-gitops.git + targetRevision: main + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true \ No newline at end of file