README.md 866 Bytes
Newer Older
Michael Yang's avatar
Michael Yang committed
1
2
3
4
# Deploy Ollama to Kubernetes

## Prerequisites

5
- Ollama: https://ollama.com/download
Michael Yang's avatar
Michael Yang committed
6
7
8
9
- Kubernetes cluster. This example will use Google Kubernetes Engine.

## Steps

10
1. Create the Ollama namespace, deployment, and service
Michael Yang's avatar
Michael Yang committed
11

12
13
14
   ```bash
   kubectl apply -f cpu.yaml
   ```
Michael Yang's avatar
Michael Yang committed
15

16
17
18
19
20
21
22
23
24
25
26
27
## (Optional) Hardware Acceleration

Hardware acceleration in Kubernetes requires NVIDIA's [`k8s-device-plugin`](https://github.com/NVIDIA/k8s-device-plugin) which is deployed in Kubernetes in form of daemonset. Follow the link for more details.

Once configured, create a GPU enabled Ollama deployment.

```bash
kubectl apply -f gpu.yaml
```

## Test

Michael Yang's avatar
Michael Yang committed
28
29
1. Port forward the Ollama service to connect and use it locally

30
31
32
   ```bash
   kubectl -n ollama port-forward service/ollama 11434:80
   ```
Michael Yang's avatar
Michael Yang committed
33

34
1. Pull and run a model, for example `orca-mini:3b`
Michael Yang's avatar
Michael Yang committed
35

36
37
   ```bash
   ollama run orca-mini:3b
38
   ```