From 2aada8b0c69538b6f437381a41a35e60e3557682 Mon Sep 17 00:00:00 2001 From: wbsong111 Date: Thu, 9 Jan 2025 15:59:54 +0900 Subject: [PATCH] Add custom-values.yaml, CUSTOM-README.md --- charts/ollama/CUSTOM-README.md | 101 +++++++++++++++++++++++++++++++ charts/ollama/custom-values.yaml | 47 ++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 charts/ollama/CUSTOM-README.md create mode 100644 charts/ollama/custom-values.yaml diff --git a/charts/ollama/CUSTOM-README.md b/charts/ollama/CUSTOM-README.md new file mode 100644 index 0000000..69a6144 --- /dev/null +++ b/charts/ollama/CUSTOM-README.md @@ -0,0 +1,101 @@ + +# ollama 배포 + +## 1. 배포 방법 + +### 1) 배포시 주의 사항 + +- 사용할 모델에 따라서 적절한 자원(CPU, Memory, GPU)를 설정한 후 배포 해야한다. + +### 2) 배포 방법 + +``` sh +git clone https://github.com/paasup/dip-catalog.git +cd charts/ollama +helm upgrade ollama ./ -f custom-values.yaml --install -n ollama --create-namespace +``` + + + +## 2.custom-values.yaml 설명 + +- custom-values.yaml에 정의된 값에 대한 설명이다. + +### 1) Pod 설정 + + +| Name | 설명 | 기본값 | +| ---------------------- | ------------------------------------------------------------ | ------ | +| `image.repositrory` | 오프라인 설치 시에 설정.
paasup 설치시에는 "paasup.io/ollama/ollama"로 설정 | `"ollama/ollama"` | +| `image.tag` | 이미지 태그 설정 | '0.5.4' | +| `runtimeClassName` | pod 실행 시 사용할 runtime을 설정
gpu-operator가 설치되어 있는 환경 에서 사용가능하다. | "nvidia" | +| `persistentVolume.enabled` | PV의 사용 여부 | 'true' | +| `persistentVolume.size` | PV 용량 | "30Gi" | +| `persistentVolume.storageClass` | PV 생성 시 사용할 Storage Class | "" | +| resources | Ollama 서버의 시스템 자원 설정.
LLM 모델에 따른 적절한 CPU, Memory 설정이 필요하다. | `custom-values.yaml` 참고 | + + + +### 2) Ollama 설정 + +- ollama 실행 시에 필요한 설정을 작성한다. ex) GPU 설정, LLM 모델 설정 + +| Name | 설명 | 기본값 | +| ------------------------ | ------------------------------------------------------ | ------------------------- | +| `ollama.gpu.enabled` | Ollama에서 GPU를 사용할지 여부 | "true" | +| `ollama.gpu.type` | GPU의 종류.
'nvidia' 또는 'amd'만 사용 가능하다. | 'nvidia' | +| `ollama.gpu.number` | 사용할 GPU의 수 | '1' | +| `ollama.gpu.models.pull` | Ollama 실행 전에 미리 Pulling할 모델 목록 설정 | `custom-values.yaml` 참고 | + + + +### 3) Ingress 설정 + +#### 3.1) tls 시크릿 직접 생성 + +- Rancher에서 ingress 사용을 위해서는 다음과 같이 설정할 수 있다. + + ``` yaml + ingress: + enabled: true + hosts: + - host: ollama.example.org + paths: + - path: / + pathType: Prefix + servicePort: 6333 + tls: + - hosts: + - ollama.example.org + secretName: ollama-tls-secret + ``` + +- ingress 사용을 위해서는 인증서를 secret으로 제공해야한다. 로컬 파일을 이용해 secret을 생성하는 방법은 다음과 같다. + + ``` sh + kubectl create secret tls ollama-tls-secret --cert= --key= -n + ``` + +#### 3.2) cert-manager를 이용한 자동 생성 + +- cert manager를 통해 인증서 자동 생성 시 `custom-values.yaml` 수정한다. +- `ingress.annotations.cert-manager.io/cluster-issuer`에 미리 배포된 Cluster Issuer의 이름으로 변경한다. + + ``` yaml + ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "selfsigned-issuer" + cert-manager.io/duration: 8760h + cert-manager.io/renew-before: 720h + hosts: + - host: ollama.example.org + paths: + - path: / + pathType: Prefix + servicePort: 6333 + tls: + - hosts: + - ollama.example.org + secretName: ollama-tls-secret + ``` diff --git a/charts/ollama/custom-values.yaml b/charts/ollama/custom-values.yaml new file mode 100644 index 0000000..b7e9321 --- /dev/null +++ b/charts/ollama/custom-values.yaml @@ -0,0 +1,47 @@ +image: + repository: ollama/ollama + tag: 0.5.4 + +# gpu operator가 설치되었을 경우 사용 가능 +runtimeClassName: nvidia + +persistentVolume: + enabled: true + size: "30Gi" + storageClass: longhorn + +resources: + requests: + memory: 4096Mi + cpu: 2000m + limits: + memory: 8192Mi + cpu: 4000m + +ollama: + gpu: + enabled: ture + type: 'nvidia' # -- GPU type: 'nvidia' or 'amd' + number: 1 # -- Specify the number of GPU to 1 + + # -- List of models to pull at container startup + models: + pull: + - mistral + #- benedict/linkbricks-mistral-nemo-korean:12b + #- benedict/linkbricks-gemma2-korean:27b + #- qwen2.5-coder:32b + #- codeqwen:7b-chat + # - llama3 + +ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "selfsigned-issuer" + cert-manager.io/duration: 8760h + cert-manager.io/renew-before: 720h + hosts: + - host: ollama.inopt.paasup.io + paths: + - path: / + pathType: Prefix \ No newline at end of file