a-cloud-all/k8s/05-nginx/README.md

932 B
Raw Permalink Blame History

05-Nginx 部署

说明

部署 Nginx 前端服务,提供静态资源访问和反向代理。

部署流程

  1. 构建前端 - 在 ruoyi-ui 目录执行 npm run build:prod
  2. 复制 dist - 复制构建产物到 docker/nginx/html
  3. 构建镜像 - 使用 docker-compose 构建 Nginx 镜像
  4. 导入镜像 - 如果是 Minikube 环境,自动导入镜像
  5. 部署到 K8s - 部署 Service 和 Deployment
  6. 等待启动 - 等待 Pod 就绪

配置说明

  • Service 名称: ruoyi-nginx
  • 端口: 80
  • NodePort: 30080外部访问端口
  • 镜像: nginx-runtime

文件说明

  • service.yaml - Nginx Service 配置NodePort
  • deployment.yaml - Nginx Deployment 配置
  • deploy.sh - 一键部署脚本

部署步骤

# 进入目录
cd 05-nginx

# 执行部署脚本
./deploy.sh

访问

# 通过 NodePort 访问
http://localhost:30080