- ansible/files 改为与文档 XX-YY 对齐的目录结构,更新相关 playbook 路径 - 新增 scripts/verify.sh 与 ansible/playbooks/verify/*.yml,移除单体 verify-matrix.yml - 补充 docs/00-02 矩阵状态、00-05 验证框架与流程、00-04 环境与 ylc65 工作机说明 - 增加 k3s 存储准备、Longhorn、local-path 等 playbook 与辅助脚本 Made-with: Cursor
54 lines
1.4 KiB
Markdown
54 lines
1.4 KiB
Markdown
# 02-04 Nginx + 工作节点 + IngressRoute(M4)
|
||
|
||
> 场景:nginx 指定落在 ylc64(`nodeSelector: kubernetes.io/hostname: ylc64`),跨节点 IngressRoute 暴露 `/demo-m4`。整合于 `02-05-nginx-验证矩阵-一键部署.md`。
|
||
|
||
## 前置条件
|
||
|
||
- 已完成 `01-02-k3s-工作节点.md`
|
||
- Traefik CRD 可用
|
||
- 工作节点网络连通
|
||
- 按实际工作节点名(如 ylc64)修改 `nodeSelector` 中的 hostname
|
||
|
||
## 操作步骤
|
||
|
||
1. 部署 nginx Deployment(nodeSelector 指定工作节点 hostname)+ Service
|
||
2. 创建 Middleware + IngressRoute(`PathPrefix(/demo-m4)`)
|
||
3. 等待资源就绪
|
||
|
||
示例 YAML 见 `ansible/files/02-05-nginx-matrix/04-worker-ingressroute.yaml`。
|
||
|
||
## 部署命令
|
||
|
||
```bash
|
||
kubectl apply -f ansible/files/02-05-nginx-matrix/04-worker-ingressroute.yaml
|
||
```
|
||
|
||
## 验证命令
|
||
|
||
```bash
|
||
kubectl get pod,svc -n default -o wide
|
||
kubectl get ingressroute -n default
|
||
curl -i --max-time 3 http://<入口节点IP>/demo-m4/
|
||
```
|
||
|
||
## 预期
|
||
|
||
- 返回 200,页面包含 Welcome to nginx!
|
||
- Pod 落在指定工作节点
|
||
|
||
## 删除
|
||
|
||
```bash
|
||
kubectl delete -f ansible/files/02-05-nginx-matrix/04-worker-ingressroute.yaml
|
||
```
|
||
|
||
## 失败排查
|
||
|
||
- 优先看 Traefik 日志
|
||
- 检查节点间网络转发、firewalld 基线
|
||
- 参考 `06-01-k3s-networkpolicy-故障排查.md`
|
||
|
||
## 下一步
|
||
|
||
- 返回 `02-05-nginx-验证矩阵-一键部署.md` 或 `00-00-构建总览.md`
|