feat: CoreDNS IPv4 上游、03-03 Tomcat 修复、HAProxy 与验证脚本
- Ansible: 部署时自动配置 CoreDNS forward 为 IPv4,避免 ACME 解析失败 - 01-01/01-07: 文档增加 CoreDNS 设置说明 - 03-03: Tomcat webapps.dist 复制、HTTP/HTTPS 双 Ingress、显式 Dashboard IngressRoute - traefik-dashboard-acme: tomcat-acme.yaml、404 排查说明 - HAProxy: 健康检查与 PROXY 配置拆分,18080/18443 部署与验证脚本 Made-with: Cursor
This commit is contained in:
@@ -70,6 +70,13 @@ k3s_worker
|
||||
|
||||
节点名必须与 `kubectl get nodes` 输出一致(使用短主机名 ylc61~ylc64)。未配置时仅打 enablelb/lbpool,不打角色标签。
|
||||
|
||||
**CoreDNS 上游 DNS**(供 ACME 解析 Let's Encrypt,见 `03-02` 常见问题):若宿主机 `/etc/resolv.conf` 为 IPv6,Pod 网络仅 IPv4 时无法解析,ACME 会失败。playbook 默认会将 CoreDNS `forward` 改为 IPv4:
|
||||
|
||||
- `k3s_manage_coredns: true`(默认开启)
|
||||
- `coredns_forward_servers: "223.5.5.5 8.8.8.8"`(可按环境修改)
|
||||
|
||||
禁用时设 `k3s_manage_coredns: false`。
|
||||
|
||||
## 5. 执行流程概览
|
||||
|
||||
playbook 依次执行:
|
||||
@@ -80,15 +87,17 @@ playbook 依次执行:
|
||||
| 2 | Install server | 安装 k3s server(`--data-dir=/storage`) |
|
||||
| 3 | Install agent | 逐台安装 worker(`serial: 1`,`async/poll` 防止卡死) |
|
||||
| 4 | Firewalld 基线 | 等待 flannel.1/cni0 出现(最多 120s),加入 trusted zone |
|
||||
| 5 | Traefik 标签 | 从集群动态获取节点名,打 enablelb/lbpool 标签 |
|
||||
| 6 | 角色标签(可选) | 当 `k3s_manage_role_labels: true` 时,为控制节点打 control-plane、工作节点打 worker |
|
||||
| 7 | 验证 | 输出 `kubectl get nodes`、`kubectl get pods -n kube-system`、curl 各节点 HTTP |
|
||||
| 5 | **CoreDNS(可选)** | 当 `k3s_manage_coredns: true` 时,将 forward 改为 IPv4(223.5.5.5 8.8.8.8),避免 ACME 解析 Let's Encrypt 失败 |
|
||||
| 6 | Traefik 标签 | 从集群动态获取节点名,打 enablelb/lbpool 标签 |
|
||||
| 7 | 角色标签(可选) | 当 `k3s_manage_role_labels: true` 时,为控制节点打 control-plane、工作节点打 worker |
|
||||
| 8 | 验证 | 输出 `kubectl get nodes`、`kubectl get pods -n kube-system`、curl 各节点 HTTP |
|
||||
|
||||
**关键实现点**:
|
||||
|
||||
- **端口 8472/udp**:flannel VXLAN 所需,必须在 Init 阶段开放,否则 worker 上 flannel 无法建立 overlay,`flannel.1` / `cni0` 永远不会出现;
|
||||
- **Firewalld 基线(flannel.1/cni0 → trusted)**:FCOS/Fedora 默认 firewalld 转发策略较严格;K3s 不会自动配置宿主机 firewalld 的 zone 接口归类。入口 Pod(Traefik/svclb-traefik)可能调度到任意节点,回包路径会经过该节点本地的 `flannel.1`/`cni0`。若某节点上 `flannel.1 ↔ cni0` 的转发被 firewalld 拦截,该节点上的入口流量就会异常,即使其它节点正常。详见 `01-02-k3s-工作节点.md`;
|
||||
- **Traefik 标签**:使用 `kubectl get nodes -o jsonpath` 获取实际节点名,不依赖 inventory 主机名与 K8s 节点名一致;
|
||||
- **CoreDNS(可选)**:宿主机若使用 IPv6 DNS(如运营商分配的 `240e:...`),Pod 网络仅 IPv4 时 CoreDNS 无法访问上游,导致 Traefik ACME 无法解析 Let's Encrypt 域名。playbook 会将 `forward . /etc/resolv.conf` 改为 `forward . 223.5.5.5 8.8.8.8`,详见 `03-02` 常见问题。
|
||||
- **角色标签(可选)**:playbook 默认只打 enablelb/lbpool,**不打** `node-role.kubernetes.io/control-plane` 与 `node-role.kubernetes.io/worker`。若需 `03-01` / `03-03` nginx 矩阵的 M1/M3 能调度,可开启 `k3s_manage_role_labels` 并配置控制节点/工作节点名列表(见下),或安装后在控制节点按 01-02 可选步骤手动打标。
|
||||
- **Agent 安装**:token 通过 `slurp` 从 server 读取,`delegate_to` 到 server 执行。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user