f3679e6176
Introduce a self-contained kustomize stack under deploy/k3s covering namespace, config, placeholder secrets, infra StatefulSets, app Deployments/Services, migration and minio-init Jobs, and Traefik Ingress for both tenant and ops hosts. Add Dockerfile.ops-web so the operations frontend can ship as an nginx image, and extend the offline package script to build and bundle ops-api, kol-assist-worker, and ops-web alongside the k3s manifests. Wire the new ops/security knobs through .env.example and the compose stack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2.7 KiB
2.7 KiB
geo-rankly k3s deployment
这套清单用于把当前 Docker Compose 拓扑搬到单节点或小集群 k3s 中。默认包含:
- infra:
postgres,monitoring-postgres,rabbitmq,redis,qdrant,minio - jobs:
migrate,minio-init - apps:
tenant-api,worker-generate,kol-assist-worker,scheduler,ops-api,frontend,ops-web - ingress:
geo-rankly.local->frontend,ops.geo-rankly.local->ops-web
1. 准备镜像
在线环境建议推到镜像仓库后修改 kustomization.yaml 里的 images:
kubectl kustomize deploy/k3s
离线或内网 k3s 可以先用现有打包脚本生成镜像包,再导入到 k3s containerd:
bash deploy/scripts/package.sh latest linux/amd64
tar xzf geo-rankly-deploy-*-amd64.tar.gz
cd geo-rankly-deploy-*-amd64
sudo k3s ctr images import images.tar
如果你的服务器是 ARM,把第二个参数换成 linux/arm64。
2. 修改密钥
上线前先改 deploy/k3s/secrets.yaml:
JWT_SECRETOPS_JWT_SECRETOPS_DEFAULT_ADMIN_PASSWORDLLM_API_KEYSILICONFLOW_API_KEYSCHEDULER_INTERNAL_METRICS_TOKENPOSTGRES_PASSWORD/RABBITMQ_DEFAULT_PASS/MINIO_ROOT_*config.local.yaml里对应的数据库、RabbitMQ、MinIO、JWT、LLM 配置
注意:ops-api 目前从 deploy/k3s/config/ops-config.yaml 读取数据库连接信息;如果改了 Postgres 密码,也同步改这个文件。
3. 部署
kubectl apply -k deploy/k3s
kubectl -n geo-rankly get pods -w
查看一次性任务:
kubectl -n geo-rankly logs job/migrate
kubectl -n geo-rankly logs job/minio-init
如果是升级后需要重新跑迁移:
kubectl -n geo-rankly delete job migrate --ignore-not-found
kubectl apply -k deploy/k3s
4. 访问
k3s 默认 Traefik 会接管 Ingress。先把域名指到 k3s 节点 IP:
<node-ip> geo-rankly.local
<node-ip> ops.geo-rankly.local
然后访问:
- tenant admin:
http://geo-rankly.local - ops admin:
http://ops.geo-rankly.local
不改 hosts 时可用端口转发:
kubectl -n geo-rankly port-forward svc/frontend 8088:80
kubectl -n geo-rankly port-forward svc/ops-web 8089:80
kubectl -n geo-rankly port-forward svc/rabbitmq 15672:15672
kubectl -n geo-rankly port-forward svc/minio 9001:9001
5. 常用排查
kubectl -n geo-rankly get all
kubectl -n geo-rankly describe pod <pod-name>
kubectl -n geo-rankly logs deploy/tenant-api -f
kubectl -n geo-rankly logs deploy/scheduler -f
kubectl -n geo-rankly logs deploy/worker-generate -f
kubectl -n geo-rankly logs deploy/ops-api -f
如果应用 Pod 先于 migrate 启动失败,通常会自动重启;等 migrate 完成后再看 kubectl -n geo-rankly get pods 即可。