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:
95
ansible/files/03-03-traefik-dashboard-acme/tomcat-acme.yaml
Normal file
95
ansible/files/03-03-traefik-dashboard-acme/tomcat-acme.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
# docs/03-03 第 5 节:Tomcat + test05.jackadam.top 验证 HTTPS(请按需改域名)
|
||||
---
|
||||
apiVersion: apps/v1 # Deployment API 版本
|
||||
kind: Deployment # 工作负载:Deployment
|
||||
metadata: # Deployment 元信息
|
||||
name: tomcat-test05 # Deployment 名称
|
||||
namespace: default # 命名空间
|
||||
labels: # 标签
|
||||
app: tomcat-test05 # 应用标签
|
||||
spec: # Deployment 规格
|
||||
replicas: 1 # 副本数
|
||||
selector: # Deployment 选择器
|
||||
matchLabels: # 标签匹配集合
|
||||
app: tomcat-test05 # 与模板标签对齐
|
||||
template: # Pod 模板
|
||||
metadata: # Pod 元信息
|
||||
labels: # Pod 标签
|
||||
app: tomcat-test05 # 与 selector.matchLabels 对齐
|
||||
spec: # Pod 规格
|
||||
containers: # 容器列表
|
||||
- name: tomcat # 容器名
|
||||
image: tomcat:9.0 # Tomcat 镜像版本
|
||||
# 官方镜像默认 webapps 在 webapps.dist;整目录复制到 webapps(与 Docker Compose cp -a webapps.dist/* webapps 等价)
|
||||
command: # 启动命令(覆盖默认 ENTRYPOINT/CMD)
|
||||
- sh # 使用 shell
|
||||
- -c # shell 执行模式
|
||||
- | # 多行脚本(内部内容保持原样)
|
||||
set -e
|
||||
CATALINA_HOME=/usr/local/tomcat
|
||||
mkdir -p "${CATALINA_HOME}/webapps"
|
||||
cp -a "${CATALINA_HOME}/webapps.dist/." "${CATALINA_HOME}/webapps/"
|
||||
exec "${CATALINA_HOME}/bin/catalina.sh" run
|
||||
ports: # 容器端口
|
||||
- containerPort: 8080 # Tomcat HTTP 端口
|
||||
---
|
||||
apiVersion: v1 # Service API 版本
|
||||
kind: Service # Service 资源
|
||||
metadata: # Service 元信息
|
||||
name: tomcat-test05 # Service 名称
|
||||
namespace: default # 命名空间
|
||||
spec: # Service 规格
|
||||
selector: # 后端 Pod 选择器
|
||||
app: tomcat-test05 # 选中 app=tomcat-test05 的 Pod
|
||||
ports: # 端口映射
|
||||
- port: 8080 # Service 暴露端口
|
||||
targetPort: 8080 # 转发到容器端口
|
||||
---
|
||||
# HTTPS(websecure)
|
||||
apiVersion: networking.k8s.io/v1 # Ingress API 版本
|
||||
kind: Ingress # Ingress 资源(HTTPS)
|
||||
metadata: # Ingress 元信息
|
||||
name: tomcat-test05-acme # HTTPS Ingress 名称
|
||||
namespace: default # 命名空间
|
||||
annotations: # Traefik 注解
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure # 使用 HTTPS 入口
|
||||
traefik.ingress.kubernetes.io/router.tls.certresolver: cloudflare # 使用 Cloudflare certresolver
|
||||
spec: # Ingress 规则
|
||||
ingressClassName: traefik # 指定 IngressClass
|
||||
tls: # TLS 配置
|
||||
- hosts: # 证书覆盖域名
|
||||
- test05.jackadam.top # 域名
|
||||
rules: # 路由规则
|
||||
- host: test05.jackadam.top # 主机匹配
|
||||
http: # HTTP 路由定义
|
||||
paths: # 路径列表
|
||||
- path: / # 根路径
|
||||
pathType: Prefix # 前缀匹配
|
||||
backend: # 后端目标
|
||||
service: # 后端 Service
|
||||
name: tomcat-test05 # Service 名称
|
||||
port: # Service 端口
|
||||
number: 8080 # 端口号
|
||||
---
|
||||
# HTTP(web,与 03-02 nginx-matrix-tls 一致:拆成两个 Ingress)
|
||||
apiVersion: networking.k8s.io/v1 # Ingress API 版本
|
||||
kind: Ingress # Ingress 资源(HTTP)
|
||||
metadata: # Ingress 元信息
|
||||
name: tomcat-test05-http # HTTP Ingress 名称
|
||||
namespace: default # 命名空间
|
||||
annotations: # Traefik 注解
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: web # 使用 HTTP 入口
|
||||
spec: # Ingress 规则
|
||||
ingressClassName: traefik # 指定 IngressClass
|
||||
rules: # 路由规则
|
||||
- host: test05.jackadam.top # 主机匹配
|
||||
http: # HTTP 路由定义
|
||||
paths: # 路径列表
|
||||
- path: / # 根路径
|
||||
pathType: Prefix # 前缀匹配
|
||||
backend: # 后端目标
|
||||
service: # 后端 Service
|
||||
name: tomcat-test05 # Service 名称
|
||||
port: # Service 端口
|
||||
number: 8080 # 端口号
|
||||
|
||||
Reference in New Issue
Block a user