论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
朋友圈
看朋友圈动态,了解ToB世界。
ToB门户
了解全球最新的ToB事件
博客
Blog
排行榜
Ranklist
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
导读
Guide
相册
Album
记录
Doing
应用中心
搜索
本版
文章
帖子
ToB圈子
用户
免费入驻
产品入驻
解决方案入驻
公司入驻
案例入驻
登录
·
注册
账号登录
立即注册
找回密码
用户名
Email
自动登录
找回密码
密码
登录
立即注册
首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
圈子
SAAS
qidao123.com技术社区-IT企服评测·应用市场
»
论坛
›
软件与程序人生
›
前端开发
›
华为云kubernetes摆设deepseek r1、ollama和open-webui ...
华为云kubernetes摆设deepseek r1、ollama和open-webui(已踩过坑) ...
西河刘卡车医
论坛元老
|
2025-2-12 18:42:00
|
显示全部楼层
|
阅读模式
楼主
主题
1925
|
帖子
1925
|
积分
5775
1 概述
ollama是一个管理大模型的一个中心层,通过它你可以下载并管理deepseek R1、llama3等大模型。
open-webui是一个web界面(界面计划受到chatgpt启发),可以集成ollama API、 OpenAI的 API。
用常见的web应用架构来类比,open-webui是前端,ollama是后端,大模型是数据库。
文本介绍华为云kubernetes摆设open-webui最新版、ollama最新版、DeepSeek-R1-Distill-Qwen-1.5B(因为小模型可以只使用CPU,节省本文测试的成本)。
2 云资源情况准备
2.1 购买文件存储SFS Turbo
2.2 购买kubernetes集群
2.3 在k8s中创建storageclass对象
参数everest.io/share-access-to是VPC的ID。
参数everest.io/share-export-location是sfs turbo实例的共享路径:自界说子目次,sfs turbo实例的共享路径是在sfs实例的详细页查询,自界说子目次可以是任意路径。
参数everest.io/volume-id是sfs turbo实例的ID。
只需要修改以上三个参数。
在本文,storageclass的名称叫做sfsturbo-subpath-sc。
apiVersion: storage.k8s.io/v1
allowVolumeExpansion: true
kind: StorageClass
metadata:
name: sfsturbo-subpath-sc
mountOptions:
- lock
parameters:
csi.storage.k8s.io/csi-driver-name: sfsturbo.csi.everest.io
csi.storage.k8s.io/fstype: nfs
everest.io/archive-on-delete: "true"
everest.io/share-access-to: xxxxxxxxxxxxxxxxxx # VPC ID
everest.io/share-expand-type: bandwidth
everest.io/share-export-location: xxxxx.sfsturbo.internal:/mydir # sfs turbo实例的共享路径:自定义子目录
everest.io/share-source: sfs-turbo
everest.io/share-volume-type: STANDARD
everest.io/volume-as: subpath
everest.io/volume-id: xxxxxxxxxxxxx # sfs turbo实例的ID
provisioner: everest-csi-provisioner
reclaimPolicy: Delete
volumeBindingMode: Immediate
复制代码
2.4 购买用于暴露容器的负载均衡器ELB
3 摆设
3.1 创建namespace
ollama和open webui都摆设在此namespace。
kubectl create ns ollama
复制代码
3.1 摆设ollama
statefulset使用刚刚创建的存储类sfsturbo-subpath-sc。
确保PVC的磁盘容量能存储下全部待下载的大模型。
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ollama
namespace: ollama
spec:
serviceName: "ollama"
replicas: 1
selector:
matchLabels:
app: ollama
template:
metadata:
labels:
app: ollama
spec:
containers:
- name: ollama
image: swr.cn-south-1.myhuaweicloud.com/migrator/ollama:0.5.7
ports:
- containerPort: 11434
resources:
requests:
cpu: "1000m"
memory: "2Gi"
# nvidia.com/gpu: "4" # 如果要用英伟达GPU,请声明下GPU卡的数量
limits:
cpu: "4000m"
memory: "4Gi"
volumeMounts:
- name: ollama-volume
mountPath: /root/.ollama
tty: true
volumeClaimTemplates:
- metadata:
name: ollama-volume
spec:
storageClassName: sfsturbo-subpath-sc
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 200Gi # 确保磁盘容量能存储下所有待下载的大模型
---
apiVersion: v1
kind: Service
metadata:
name: ollama
namespace: ollama
labels:
app: ollama
spec:
type: ClusterIP
ports:
- port: 11434
protocol: TCP
targetPort: 11434
selector:
app: ollama
复制代码
3.1 摆设open webui(重点)
deployment挂载一个固定的PVC,PVC使用刚刚创建的存储类sfsturbo-subpath-sc。
OLLAMA_BASE_URL情况变量是ollama的地址。
无法毗连huggingface.co:
由于在国内情况是无法毗连huggingface.co,最终导致open webui的界面是一片空缺(应用日志报错:MaxRetryError("HTTPSConnectionPool(host=‘huggingface.co’, port=443)),因此需要增长情况变量HF_ENDPOINT=https://hf-mirror.com。
无法毗连openai:
由于不使用openai,因此将情况变量OPENAI_API_BASE_URL和OPENAI_API_KEY都设置成None,否则open webui在国内情况是无法毗连openai,最终导致open webui的界面是一片空缺(应用日志报错:Connection error: Cannot connect to host api.openai.com:443)。
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: webui-pvc
namespace: ollama
labels:
app: webui
spec:
storageClassName: sfsturbo-subpath-sc
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: webui
namespace: ollama
spec:
replicas: 1
selector:
matchLabels:
app: webui
template:
metadata:
labels:
app: webui
spec:
containers:
- name: webui
image: swr.cn-south-1.myhuaweicloud.com/migrator/open-webui:main
env:
- name: OLLAMA_BASE_URL # 这是ollama的地址
value: http://ollama:11434
- name: HF_ENDPOINT # 国内环境无法连接huggingface.co
value: https://hf-mirror.com
- name: OPENAI_API_KEY
value: None
- name: OPENAI_API_BASE_URL
value: None
tty: true
ports:
- containerPort: 8080
resources:
requests:
cpu: "500m"
memory: "500Mi"
limits:
cpu: "1000m"
memory: "1Gi"
volumeMounts:
- name: webui-volume
mountPath: /app/backend/data
volumes:
- name: webui-volume
persistentVolumeClaim:
claimName: webui-pvc
---
apiVersion: v1
kind: Service
metadata:
name: webui
namespace: ollama
labels:
app: webui
spec:
type: ClusterIP
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: webui
复制代码
接着为open webui容器添加ingress路由以在公网暴露:
4 下载模型
进入ollama容器:
kubectl exec -it ollama-0 -n ollama bash
复制代码
在容器内执行ollama pull下令下载大模型DeepSeek-R1-Distill-Qwen-1.5B。
nohup ollama pull deepseek-r1:1.5b &
tail -f nohup.out
复制代码
有哪些deepseek模型可以下载,请去https://ollama.com/library/deepseek-r1地址里搜刮。
5 与大模型对话
在浏览器地址输入负载均衡器ELB的公网IP,打开网页后需要先设置open webui的管理员账号密码,登录乐成后即可选择刚刚下载的deepseek模型来谈天。
6 小结
文本介绍使用华为云kubernetes摆设open-webui最新版、ollama最新版、DeepSeek-R1-Distill-Qwen-1.5B。在现实过程中,花费时间最多的是open-webui,因为它默认去访问在国内无法访问的两个外国地址:huggingface.co和api.openai.com,而访问这些地址最终又导致界面变成空缺。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
本帖子中包含更多资源
您需要
登录
才可以下载或查看,没有账号?
立即注册
x
回复
使用道具
举报
0 个回复
倒序浏览
返回列表
快速回复
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
or
立即注册
本版积分规则
发表回复
回帖并转播
回帖后跳转到最后一页
发新帖
回复
西河刘卡车医
论坛元老
这个人很懒什么都没写!
楼主热帖
【容器~原始真解】Docker —— 容器的 ...
轻量级CI/CD发布部署环境搭建及使用_06 ...
工行、建行、农行的 IT 架构是什么样的 ...
全双工与半双工技术剖析
PHP判断远程文件是否存在的四种方法 ...
超融合一体机上新,打通信创落地的“顶 ...
Spring--循环依赖的原理(四)--为什么用 ...
继承和多重继承
一文了解华为FusionInsight MRS HBase ...
MySQL高可用架构搭建实战
标签云
渠道
国产数据库
集成商
AI
运维
CIO
存储
服务器
浏览过的版块
向量数据库
人工智能
快速回复
返回顶部
返回列表