SUSE AI 使用随记

SUSE AI 是一个开放的生成式人工智能解决方案,主要包含以下组件:

  1. Ollama:简化本地设备上大型语言模型 (LLM) 安装和管理的平台。
  2. Open WebUI:Ollama LLM 运行程序的可扩展网络用户界面。
  3. Milvus:为生成式人工智能应用构建的向量数据库,性能损失最小。

安装前准备

安装 SUSE AI 前需要安装 cert-manager:

1
2
3
4
5
6
7
8
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.15.3 \
--set crds.enabled=true

还需要安装中间件使用的存储,这里使用 local-path:

1
$ kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.31/deploy/local-path-storage.yaml

其它安装前准备:

1
2
3
4
5
6
7
8
9
10
11
kubectl create namespace suse-private-ai

kubectl create secret docker-registry application-collection \
--docker-server=dp.apps.rancher.io \
--docker-username=APPCO_USERNAME \
--docker-password=APPCO_USER_TOKEN \
-n suse-private-ai

helm registry login dp.apps.rancher.io/charts \
-u APPCO_USERNAME \
-p APPCO_USER_TOKEN

安装 Milvus

准备 Milvus 配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cat <<EOF > milvus_custom_overrides.yaml
global:
imagePullSecrets:
- application-collection
cluster:
enabled: True
standalone:
persistence:
persistentVolumeClaim:
storageClass: local-path
etcd:
replicaCount: 1
persistence:
storageClassName: local-path
minio:
mode: standalone
replicas: 1
rootUser: "admin"
rootPassword: "adminminio"
persistence:
storageClass: local-path
resources:
requests:
memory: 1024Mi
persistence:
enabled: true
storageClass: local-path
accessMode: ReadWriteOnce
size: 10Gi
kafka:
enabled: true
name: kafka
replicaCount: 3
controller:
statefulset:
replicas: 1
broker:
enabled: true
statefulset:
replicas: 1
cluster:
listeners:
client:
protocol: 'PLAINTEXT'
controller:
protocol: 'PLAINTEXT'
persistence:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: "local-path"
EOF

如需自定义镜像仓库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cat <<EOF > milvus_custom_overrides.yaml
image:
all:
registry: harbor.warnerchen.com
repository: appco/containers/milvus
cluster:
enabled: True
standalone:
persistence:
persistentVolumeClaim:
storageClass: local-path
etcd:
images:
etcd:
registry: harbor.warnerchen.com
repository: appco/containers/etcd
replicaCount: 1
persistence:
storageClassName: local-path
minio:
image:
registry: harbor.warnerchen.com
repository: appco/containers/minio
mcImage:
registry: harbor.warnerchen.com
repository: appco/containers/mc
mode: standalone
replicas: 1
rootUser: "admin"
rootPassword: "adminminio"
persistence:
storageClass: local-path
resources:
requests:
memory: 1024Mi
persistence:
enabled: true
storageClass: local-path
accessMode: ReadWriteOnce
size: 10Gi
kafka:
images:
controller:
registry: harbor.warnerchen.com
repository: appco/containers/apache-kafka
broker:
registry: harbor.warnerchen.com
repository: appco/containers/apache-kafka
enabled: true
name: kafka
replicaCount: 3
controller:
statefulset:
replicas: 1
broker:
enabled: true
statefulset:
replicas: 1
cluster:
listeners:
client:
protocol: 'PLAINTEXT'
controller:
protocol: 'PLAINTEXT'
persistence:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: "local-path"
EOF

安装 Milvus:

1
2
3
helm upgrade --install milvus oci://dp.apps.rancher.io/charts/milvus \
-n suse-private-ai \
--version 4.2.2 -f milvus_custom_overrides.yaml

安装 Ollama

准备 Ollama 配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cat <<EOF > ollama_custom_overrides.yaml
global:
imagePullSecrets:
- application-collection
replicaCount: 1
runtimeClassName: "nvidia"
ingress:
enabled: false
defaultModel: "llama2"
ollama:
models:
- "llama2"
gpu:
enabled: true
type: 'nvidia'
number: 1
persistentVolume:
enabled: true
storageClass: local-path
EOF

如需自定义镜像仓库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cat <<EOF > ollama_custom_overrides.yaml
image:
repository: appco/containers/ollama
registry: harbor.warnerchen.com
pullPolicy: IfNotPresent
replicaCount: 1
runtimeClassName: "nvidia"
ingress:
enabled: false
defaultModel: "llama2"
ollama:
models:
- "llama2"
gpu:
enabled: true
type: 'nvidia'
number: 1
persistentVolume:
enabled: true
storageClass: local-path
EOF

安装 Ollama:

1
2
3
helm upgrade --install ollama oci://dp.apps.rancher.io/charts/ollama \
-n suse-private-ai \
--version 0.63.0 -f ollama_custom_overrides.yaml

安装 Open WebUI

准备 Open WebUI 配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
cat <<EOF > owui_custom_overrides.yaml
global:
imagePullSecrets:
- application-collection
ollamaUrls:
- http://ollama.suse-private-ai.svc.cluster.local:11434
persistence:
enabled: true
storageClass: local-path
ollama:
enabled: false
pipelines:
enabled: False
ingress:
enabled: true
class: "nginx"
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
host: suse-ollama-webui.warnerchen.com
tls: true
extraEnvVars:
- name: DEFAULT_MODELS
value: "llama2"
- name: DEFAULT_USER_ROLE
value: "user"
- name: WEBUI_NAME
value: "SUSE AI"
- name: GLOBAL_LOG_LEVEL
value: INFO
- name: RAG_EMBEDDING_MODEL
value: "sentence-transformers/all-MiniLM-L6-v2"
- name: VECTOR_DB
value: "milvus"
- name: MILVUS_URI
value: http://milvus.suse-private-ai.svc.cluster.local:19530
- name: INSTALL_NLTK_DATASETS
value: "true"
cert-manager:
enabled: false
EOF

如需自定义镜像仓库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cat <<EOF > owui_custom_overrides.yaml
image:
registry: harbor.warnerchen.com
repository: appco/containers/open-webui
pullPolicy: IfNotPresent
ollamaUrls:
- http://ollama.suse-private-ai.svc.cluster.local:11434
persistence:
enabled: true
storageClass: local-path
ollama:
enabled: false
pipelines:
enabled: False
ingress:
enabled: true
class: "nginx"
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
host: suse-ollama-webui.warnerchen.com
tls: true
extraEnvVars:
- name: DEFAULT_MODELS
value: "llama2"
- name: DEFAULT_USER_ROLE
value: "user"
- name: WEBUI_NAME
value: "SUSE AI"
- name: GLOBAL_LOG_LEVEL
value: INFO
- name: RAG_EMBEDDING_MODEL
value: "sentence-transformers/all-MiniLM-L6-v2"
- name: VECTOR_DB
value: "milvus"
- name: MILVUS_URI
value: http://milvus.suse-private-ai.svc.cluster.local:19530
- name: INSTALL_NLTK_DATASETS
value: "true"
cert-manager:
enabled: false
EOF

等待所有 Pod 正常运行:

访问 Open WebUI:

选择模型进行对话:

可以看到 Ollama 调用 GPU:

参考链接:

  1. https://hackmd.io/@7vxmAdNPTmmlYGSRMuvbmw/HkibY6m8ke
  2. https://documentation.suse.com/suse-ai/1.0/html/AI-deployment-intro/index.html
Author

Warner Chen

Posted on

2025-02-19

Updated on

2025-02-27

Licensed under

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

Comments

You forgot to set the shortname for Disqus. Please set it in _config.yml.