基本框架
This commit is contained in:
51
docs/02-02-nginx-control-ingressroute.md
Normal file
51
docs/02-02-nginx-control-ingressroute.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# 02-02 Nginx + 控制节点 + IngressRoute(M2)
|
||||
|
||||
> 场景:nginx 指定一台控制节点(`nodeSelector: kubernetes.io/hostname: ylc61`),路由使用 Traefik CRD `IngressRoute`,暴露 `/demo-m2`。整合于 `02-05-nginx-验证矩阵-一键部署.md`。
|
||||
|
||||
## 前置条件
|
||||
|
||||
- 已完成 `01-02-k3s-工作节点.md`
|
||||
- Traefik CRD 可用
|
||||
- 按实际控制节点名(如 ylc61)修改 `nodeSelector` 中的 hostname
|
||||
|
||||
## 操作步骤
|
||||
|
||||
1. 部署 nginx Deployment(nodeSelector 指定控制节点 hostname)+ Service
|
||||
2. 创建 Middleware + IngressRoute(`PathPrefix(/demo-m2)`)
|
||||
3. 等待资源就绪
|
||||
|
||||
示例 YAML 见 `ansible/files/nginx-matrix/02-control-ingressroute.yaml`。
|
||||
|
||||
## 部署命令
|
||||
|
||||
```bash
|
||||
kubectl apply -f ansible/files/nginx-matrix/02-control-ingressroute.yaml
|
||||
```
|
||||
|
||||
## 验证命令
|
||||
|
||||
```bash
|
||||
kubectl get pod,svc -n default -o wide
|
||||
kubectl get ingressroute -n default
|
||||
curl -i --max-time 3 http://<入口节点IP>/demo-m2/
|
||||
```
|
||||
|
||||
## 预期
|
||||
|
||||
- 返回 200,页面包含 Welcome to nginx!
|
||||
- Pod 落在指定控制节点
|
||||
|
||||
## 删除
|
||||
|
||||
```bash
|
||||
kubectl delete -f ansible/files/nginx-matrix/02-control-ingressroute.yaml
|
||||
```
|
||||
|
||||
## 失败排查
|
||||
|
||||
- 确认 CRD 已存在、Traefik 日志无路由错误
|
||||
- 参考 `06-01-k3s-networkpolicy-故障排查.md`
|
||||
|
||||
## 下一步
|
||||
|
||||
- 返回 `02-05-nginx-验证矩阵-一键部署.md` 或 `00-00-构建总览.md`
|
||||
Reference in New Issue
Block a user