基本框架
This commit is contained in:
50
docs/02-01-nginx-control-ingress.md
Normal file
50
docs/02-01-nginx-control-ingress.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# 02-01 Nginx + 控制节点 + Ingress(M1)
|
||||
|
||||
> 场景:nginx 落在控制节点(`nodeSelector: node-role.kubernetes.io/control-plane`),使用标准 Ingress 暴露 `/demo-m1`。整合于 `02-05-nginx-验证矩阵-一键部署.md`。
|
||||
|
||||
## 前置条件
|
||||
|
||||
- 已完成 `01-02-k3s-工作节点.md`
|
||||
- 控制节点有 `node-role.kubernetes.io/control-plane` 标签
|
||||
- 入口节点 80 可达
|
||||
|
||||
## 操作步骤
|
||||
|
||||
1. 部署 nginx Deployment(nodeSelector 控制节点)+ Service
|
||||
2. 创建 Middleware + Ingress(`/demo-m1` -> nginx-m1:80)
|
||||
3. 等待 Pod 与 Ingress 就绪
|
||||
|
||||
示例 YAML 见 `ansible/files/nginx-matrix/01-control-ingress.yaml`。
|
||||
|
||||
## 部署命令
|
||||
|
||||
```bash
|
||||
kubectl apply -f ansible/files/nginx-matrix/01-control-ingress.yaml
|
||||
```
|
||||
|
||||
## 验证命令
|
||||
|
||||
```bash
|
||||
kubectl get pod,svc,ing -n default -o wide
|
||||
curl -i --max-time 3 http://<入口节点IP>/demo-m1/
|
||||
```
|
||||
|
||||
## 预期
|
||||
|
||||
- 返回 200,页面包含 Welcome to nginx!
|
||||
- Pod 落在控制节点(`kubectl get pod -o wide` 的 NODE 列为控制节点)
|
||||
|
||||
## 删除
|
||||
|
||||
```bash
|
||||
kubectl delete -f ansible/files/nginx-matrix/01-control-ingress.yaml
|
||||
```
|
||||
|
||||
## 失败排查
|
||||
|
||||
- 确认 Traefik 接管 Ingress、Service/Endpoint 正常
|
||||
- 参考 `06-01-k3s-networkpolicy-故障排查.md`
|
||||
|
||||
## 下一步
|
||||
|
||||
- 返回 `02-05-nginx-验证矩阵-一键部署.md` 或 `00-00-构建总览.md`
|
||||
Reference in New Issue
Block a user