# CMII Live Services - Merged 部署文档 ## 概述 - **Media Suite**: WVP + ZLM + ZLM-OSS 三个容器合并部署在一个 Pod 中 - **网络模式**: HostNetwork (直接使用宿主机网络) - **共享存储**: ZLM 和 ZLM-OSS 共享 HLS 数据卷 - **其他服务**: Live Operator、Live Proxy、Live Helper 独立部署 使用 NodePort 暴露 ## 目录结构 ``` merge/ ├── Chart.yaml # Helm Chart 元数据 ├── values.yaml # 配置文件 ├── deploy.sh # 一键部署脚本 └── templates/ ├── media-suite-deployment.yaml # Media Suite (WVP+ZLM+ZLM-OSS) ├── live-op-deployment.yaml # Live Operator ├── live-proxy-deployment.yaml # Live Proxy ├── live-helper-deployment.yaml # Live Helper ├── wvp-configmap.yaml # WVP 配置 ├── zlm-configmap.yaml # ZLM 配置 ├── zlm-oss-configmap.yaml # ZLM-OSS 配置 ├── live-op-configmap.yaml # Live Operator 配置 ├── live-proxy-configmap.yaml # Live Proxy 配置 ├── live-helper-configmap.yaml # Live Helper 配置 ├── pvc.yaml # 持久化存储 ├── harborsecret.yaml # 镜像拉取密钥 └── NOTES.txt # 部署提示 ``` ## 当前服务前置 - Kubernetes 集群 (1.30.14) - Helm (3.20.2) - kubectl - NFS StorageClass (用于 HLS 数据共享存储) - 外部服务: MySQL、Redis、MinIO、RabbitMQ ## 快速开始 ### 1. 修改配置 编辑 `values.yaml` 文件,根据实际情况修改: ```yaml # 镜像配置 images: zlm: repository: your-registry/zlm tag: v2.7.5 wvp: repository: your-registry/wvp tag: v2.7.4 # ... 其他镜像配置 # 外部依赖配置 external: database: host: "your-mysql-host" port: "3306" username: "root" password: "your-password" redis: host: "your-redis-host" port: "6379" password: "your-password" minio: endpoint: "http://your-minio-host:9000" accessKey: "your-access-key" secretKey: "your-secret-key" rabbitmq: host: "your-rabbitmq-host" port: "5672" username: "admin" password: "your-password" # 持久化存储 persistence: zlm: hls: storageClass: "your-nfs-storage-class" ``` ### 2. 配置 Harbor 镜像密钥 (可选) 如果使用私有镜像仓库,需要配置镜像拉取密钥: ```bash # 生成 Docker Config JSON 的 Base64 编码 cat ~/.docker/config.json | base64 -w 0 # 将输出粘贴到 values.yaml 中 images: dockerConfigJson: "eyJhdXRocyI6..." ``` ### 3. 执行部署 ```bash # 赋予执行权限 chmod +x deploy.sh # 执行部署 ./deploy.sh ``` 部署脚本会自动: - 检查前置条件 - 验证配置文件 - 创建命名空间 - 安装/升级 Helm Release - 等待 Pod 就绪 - 显示服务状态和访问地址 ### 4. 验证部署 ```bash # 查看 Pod 状态 kubectl get pods -n uavcloud-live-test # 查看服务状态 kubectl get svc -n uavcloud-live-test # 查看 Media Suite 日志 kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c zlm kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c wvp kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c zlm-oss ``` ```text 下面的内容为运维内容,按需查看即可 ================================================================================= ``` ## 服务访问 ### Media Suite (HostNetwork 模式) 使用宿主机 IP 直接访问: | 服务 | 协议 | 端口 | 示例 | |------------|--------|------|-------------------------| | WVP HTTP | HTTP | 7082 | http://:7082 | | WVP SIP | UDP | 7060 | :7060 | | ZLM HTTP | HTTP | 7088 | http://:7088 | | ZLM HTTPS | HTTPS | 7089 | https://:7089 | | ZLM RTMP | RTMP | 7935 | rtmp://:7935 | | ZLM RTSP | RTSP | 7554 | rtsp://:7554 | | ZLM WebRTC | WebRTC | 7090 | webrtc://:7090 | | ZLM SRT | SRT | 7556 | srt://:7556 | | ZLM-OSS | HTTP | 7084 | http://:7084 | ### 其他服务 (NodePort 模式) | 服务 | 端口 | 示例 | |---------------|-------|------------------------| | Live Operator | 37086 | http://:37086 | | Live Proxy | 37081 | http://:37081 | | Live Helper | 37080 | http://:37080 | ### 容器间通信 由于使用 HostNetwork 和同 Pod 部署,容器间通过 `127.0.0.1` 通信: - WVP → ZLM: `http://127.0.0.1:7088` - ZLM → WVP Hooks: `http://127.0.0.1:7082` - ZLM → ZLM-OSS Hooks: `http://127.0.0.1:7084` ### 共享存储 ZLM 和 ZLM-OSS 挂载同一个 PVC: - ZLM: `/home/koisi/zlm/www/zlm/hls` - ZLM-OSS: `/cmii/share/hls` ## 运维操作 ### 查看日志 ```bash # Media Suite - WVP kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c wvp # Media Suite - ZLM kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c zlm # Media Suite - ZLM-OSS kubectl logs -f deployment/helm-live-media-suite -n uavcloud-live-test -c zlm-oss # Live Operator kubectl logs -f deployment/helm-live-live-op -n uavcloud-live-test ``` ### 进入容器 ```bash # 进入 ZLM 容器 kubectl exec -it deployment/helm-live-media-suite -n uavcloud-live-test -c zlm -- bash # 进入 WVP 容器 kubectl exec -it deployment/helm-live-media-suite -n uavcloud-live-test -c wvp -- bash ``` ### 升级服务 ```bash # 修改 values.yaml 后执行升级 helm upgrade helm-live ./merge -n uavcloud-live-test -f values.yaml # 或使用部署脚本 bash deploy.sh ``` ### 回滚 ```bash # 查看历史版本 helm history helm-live -n uavcloud-live-test # 回滚到指定版本 helm rollback helm-live -n uavcloud-live-test ``` ### 卸载 ```bash helm uninstall helm-live -n uavcloud-live-test ```