feat: 按 doc_id 重组 ansible/files 与验证框架

- 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
This commit is contained in:
2026-03-26 07:01:14 +08:00
parent a67788de56
commit 8c43761962
192 changed files with 4006 additions and 320 deletions

View File

@@ -0,0 +1,95 @@
# 03-02: Nginx + 控制节点 + IngressRouteM2
# 路径 /demo-m2指定一台控制节点按实际 FQDN 修改 kubernetes.io/hostname
# ConfigMap首页 + default.confX-Backend: M2 便于区分
---
apiVersion: v1 # ConfigMap 使用的 API 版本
kind: ConfigMap # 配置资源类型ConfigMap
metadata: # ConfigMap 标识信息
name: nginx-m2-html # ConfigMap 名称
namespace: default # 命名空间
data: # ConfigMap 数据区
index.html: | # HTML 内容:会挂载到 nginx 的网页目录
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>M2</title></head>
<body><h1>M2</h1><p>控制节点 + IngressRoute</p></body></html>
default.conf: | # nginx 配置:通过 subPath 单文件挂载到 conf.d/default.conf
server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; location / { add_header X-Backend "M2"; try_files $uri $uri/ /index.html; } }
---
apiVersion: apps/v1 # Deployment 使用的 API 版本
kind: Deployment # 工作负载Deployment
metadata: # Deployment 标识信息
name: nginx-m2 # Deployment 名称
namespace: default # 部署命名空间
labels: # 标签集合
app: nginx-m2 # 应用标签
matrix: "02-05-m2" # 矩阵编号标签
spec: # Deployment 期望状态
replicas: 1 # 副本数:单副本便于验证
selector: # Deployment 选择 Pod
matchLabels: # 标签匹配集合(用于选中模板 Pod
app: nginx-m2 # 必须与 template.metadata.labels 对上
template: # Pod 模板
metadata: # Pod 元信息
labels: # Pod 标签
app: nginx-m2 # Pod 标签
spec: # Pod 规范
nodeSelector: # 固定调度节点(按实际修改)
kubernetes.io/hostname: ylc61 # 目标节点主机名
volumes: # 卷定义
- name: html # 卷名
configMap: # 卷来源为 ConfigMap
name: nginx-m2-html # 引用的 ConfigMap 名称
containers: # 容器列表
- name: nginx # 容器名
image: nginx:alpine # nginx 镜像
ports: # 容器端口声明
- containerPort: 80 # nginx 监听端口
volumeMounts: # 容器内挂载点
- name: html # 对应 volumes[].name
mountPath: /usr/share/nginx/html/index.html # 挂到网页文件
subPath: index.html # 使用 ConfigMap 的 index.html key
readOnly: true # 配置只读挂载
- name: html # 第二处配置仍复用该卷
mountPath: /etc/nginx/conf.d/default.conf # 挂到 nginx 配置文件
subPath: default.conf # 使用 ConfigMap 的 default.conf key
readOnly: true # 只读挂载
---
apiVersion: v1 # Service 使用的 API 版本
kind: Service # 网络抽象:为 Pod 提供稳定访问地址
metadata: # Service 标识
name: nginx-m2 # Service 名称
namespace: default # 命名空间
spec: # Service 期望状态
selector: # 通过标签选择后端 Pod
app: nginx-m2 # 选择 app 标签为 nginx-m2 的 Pod
ports: # Service 端口映射
- port: 80 # Service 暴露端口
targetPort: 80 # 转发到 Pod 容器端口
---
apiVersion: traefik.io/v1alpha1 # Traefik Middleware 使用的 API 版本
kind: Middleware # 中间件类型stripPrefix
metadata: # Middleware 标识
name: stripprefix-m2 # Middleware 名称
namespace: default # 命名空间
spec: # 中间件配置
stripPrefix: # 去掉路径前缀
prefixes: # 需要剔除的前缀列表
- /demo-m2 # 本矩阵的路径前缀
---
apiVersion: traefik.io/v1alpha1 # IngressRoute 的 API 版本
kind: IngressRoute # 路由资源类型
metadata: # IngressRoute 标识
name: nginx-m2 # 路由名称
namespace: default # 命名空间
spec: # 路由规则
entryPoints: # Traefik 入口点列表
- web # 使用 web entrypoint
routes: # 路由列表
- match: PathPrefix(`/demo-m2`) # 匹配 /demo-m2 前缀
kind: Rule # 规则类型Rule
middlewares: # 绑定中间件(去前缀)
- name: stripprefix-m2 # 使用 stripprefix-m2
services: # 匹配后转发的服务
- name: nginx-m2 # 后端 Service 名称
port: 80 # 后端 Service 端口