Example to run ollama on OpenShift #917

Closed
opened 2025-11-12 09:49:38 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @jeremyssc on GitHub (Dec 20, 2023).

Hello, I ran into a permission problem when running the Kubernetes example on OpenShift since the example didn't create a persistent volume claim and a volume.

You will find attached to this issue a txt file with the manifests I used to make it work if it could help you.
openshift-ollama-example.txt

Here is also the content of the file if the file isn't uploading:

 ---
apiVersion: v1
kind: Namespace
metadata:
  name: ollama
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ollama-storage
  namespace: ollama
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 100Gi
  storageClassName: ocs-external-storagecluster-cephfs
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ollama
  namespace: ollama
spec:
  selector:
    matchLabels:
      name: ollama
  template:
    metadata:
      labels:
        name: ollama
        app: ollama-serve
    spec:
      containers:
      - name: ollama
        image: ollama/ollama:latest
        ports:
        - name: http
          containerPort: 11434
          protocol: TCP
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /.ollama
          name: ollama-storage
      restartPolicy: Always
      volumes:
      - name: ollama-storage
        persistentVolumeClaim:
          claimName: ollama-storage
---
apiVersion: v1
kind: Service
metadata:
  name: ollama
  namespace: ollama
spec:
  type: ClusterIP
  selector:
    name: ollama
  ports:
  - port: 80
    name: http
    targetPort: http
    protocol: TCP
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  name: ollama
  namespace: ollama
  labels: {}
spec:
  to:
    kind: Service
    name: ollama
  tls: null
  port:
    targetPort: http

Thanks for the great project and take care :)

Originally created by @jeremyssc on GitHub (Dec 20, 2023). Hello, I ran into a permission problem when running the Kubernetes example on OpenShift since the example didn't create a persistent volume claim and a volume. You will find attached to this issue a txt file with the manifests I used to make it work if it could help you. [openshift-ollama-example.txt](https://github.com/jmorganca/ollama/files/13732387/openshift-ollama-example.txt) Here is also the content of the file if the file isn't uploading: ``` --- apiVersion: v1 kind: Namespace metadata: name: ollama --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ollama-storage namespace: ollama spec: accessModes: - ReadWriteOnce volumeMode: Filesystem resources: requests: storage: 100Gi storageClassName: ocs-external-storagecluster-cephfs --- apiVersion: apps/v1 kind: Deployment metadata: name: ollama namespace: ollama spec: selector: matchLabels: name: ollama template: metadata: labels: name: ollama app: ollama-serve spec: containers: - name: ollama image: ollama/ollama:latest ports: - name: http containerPort: 11434 protocol: TCP terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /.ollama name: ollama-storage restartPolicy: Always volumes: - name: ollama-storage persistentVolumeClaim: claimName: ollama-storage --- apiVersion: v1 kind: Service metadata: name: ollama namespace: ollama spec: type: ClusterIP selector: name: ollama ports: - port: 80 name: http targetPort: http protocol: TCP --- kind: Route apiVersion: route.openshift.io/v1 metadata: name: ollama namespace: ollama labels: {} spec: to: kind: Service name: ollama tls: null port: targetPort: http ``` Thanks for the great project and take care :)
GiteaMirror added the dockerdocumentation labels 2025-11-12 09:49:38 -06:00
Author
Owner

@hbelmiro commented on GitHub (Jan 2, 2024):

@jeremyssc I had to remove storageClassName: ocs-external-storagecluster-cephfs from your file to make it work.
Are you willing to send a PR? Otherwise I can do it.

@hbelmiro commented on GitHub (Jan 2, 2024): @jeremyssc I had to remove `storageClassName: ocs-external-storagecluster-cephfs` from your file to make it work. Are you willing to send a PR? Otherwise I can do it.
Author
Owner

@jmorganca commented on GitHub (May 10, 2024):

Thanks for the issue! Would it be possible to turn this into a PR for a kubernetes example?

@jmorganca commented on GitHub (May 10, 2024): Thanks for the issue! Would it be possible to turn this into a PR for a kubernetes example?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama-ollama#917