Files
Deploy-Laboratory/ansible/files/homer/homer.yaml
jack be97836e0d chore: 清理调试脚本并收敛到 Ansible 流程
移除已废弃的调试/验证脚本与空目录,统一文档与脚本说明到 ansible-playbook 的部署方式,避免失效引用和误用路径。

Made-with: Cursor
2026-03-23 19:18:55 +08:00

54 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# docs/05-01-k3s-部署homer首页面板.md — 按需修改 host
apiVersion: apps/v1 # Deployment 使用的 API 版本
kind: Deployment # 工作负载Deployment管理 Pod 副本)
metadata: # 对该资源的标识信息
name: homer # Deployment 名称
namespace: homer # 所属命名空间Pod 也会在该 NS 内)
spec: # Deployment 期望状态
replicas: 1 # Pod 副本数:这里是 1单副本更容易配合本地存储等
selector: # Deployment 用于匹配管理 Pod 的条件
matchLabels: # 标签匹配:必须与 template.metadata.labels 一致
app: homer # 选择带有 app=homer 标签的 Pod
template: # Pod 模板Deployment 会根据该模板创建/更新 Pod
metadata: # Pod 的元信息
labels: # Pod 标签:用于 selector 匹配 Service/Deployment 等
app: homer # Pod 上的标签 app=homer
spec: # Pod 规范
containers: # 容器列表(本例只有一个容器)
- name: homer # 容器名称(日志/调试中会用到)
image: b4bz/homer:latest # homer 镜像
ports: # 容器端口声明(供探测/生成文档等使用)
- containerPort: 8080 # 容器监听端口homer 默认 8080
---
apiVersion: v1 # Service 使用的 API 版本
kind: Service # 网络抽象:把一组 Pod 暴露为稳定的访问入口
metadata: # Service 标识
name: homer # Service 名称Ingress/其他对象会引用)
namespace: homer # Service 所在命名空间
spec: # Service 期望状态
selector: # Service 通过标签选择要转发到的 Pod
app: homer # 选择 app=homer 的 Pod
ports: # Service 暴露端口列表
- port: 80 # Service 端口Ingress/集群访问时用它
targetPort: 8080 # 转发目标端口Pod 容器监听的端口
---
apiVersion: networking.k8s.io/v1 # Ingress 使用的 API 版本
kind: Ingress # 入口资源:对外暴露 HTTP/HTTPS 路由
metadata: # Ingress 标识
name: homer # Ingress 名称
namespace: homer # Ingress 所在命名空间
annotations: # 注解:用于 Traefik 等 Ingress Controller 的额外配置
traefik.ingress.kubernetes.io/router.entrypoints: web # Traefik 路由使用的 entrypointHTTP
spec: # Ingress 规则
rules: # 主机/路径规则列表
- host: home.example.com # 要匹配的域名(按需修改)
http: # HTTP 路由规则
paths: # 路径匹配列表
- path: / # 匹配根路径及其子路径
pathType: Prefix # Prefix 表示前缀匹配
backend: # 匹配到后端目标
service: # 使用 Service 作为后端
name: homer # 后端 Service 名称
port: # 后端端口配置
number: 80 # 后端 Service 端口