Files
2026-03-29 09:08:01 +08:00

86 lines
2.7 KiB
YAML
Raw Permalink 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.
# 03-03 Traefik Dashboard + ACME合并版 HelmChartConfig
# 说明:同一 chart 只能有一份 HelmChartConfigname: traefik所以 Dashboard 与 ACME 必须合并。
# 使用前:替换 <YOUR_REAL_EMAIL>;创建 cloudflare-api-token Secret按实际修改 nodeSelector/trustedIPs/hosts。
---
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
# chart 39.xexpose 须为表,布尔会与默认 values 合并冲突并导致 helm upgrade 模板失败
ports:
web:
expose:
default: true
websecure:
expose:
default: true
traefik:
expose:
default: true
additionalArguments:
# Dashboard
- "--api.dashboard=true"
- "--api.insecure=true"
# ACMECloudflare DNS-01
- "--certificatesresolvers.cloudflare.acme.dnschallenge.resolvers=1.1.1.1:53,1.0.0.1:53"
- "--certificatesresolvers.cloudflare.acme.email=<YOUR_REAL_EMAIL>"
- "--certificatesresolvers.cloudflare.acme.storage=/data/acme.json"
# - "--certificatesresolvers.cloudflare.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.cloudflare.acme.dnschallenge.provider=cloudflare"
- "--certificatesresolvers.cloudflare.acme.dnschallenge.propagation.delayBeforeChecks=600"
# 健康检查:/ping 走 443给 HAProxy https httpchk 用)
- "--ping=true"
- "--ping.entryPoint=websecure"
# PROXY protocolHAProxy 前置时需要)
- "--entrypoints.web.proxyProtocol.trustedIPs=192.168.2.0/24"
- "--entrypoints.websecure.proxyProtocol.trustedIPs=192.168.2.0/24"
env:
- name: CF_DNS_API_TOKEN
valueFrom:
secretKeyRef:
name: cloudflare-api-token
key: api-token
nodeSelector:
kubernetes.io/hostname: ylc61
# ping 绑定 websecure 时chart 默认仍对 traefik(8080) 做 HTTP /ping → 404与 chart 39 对齐探针
deployment:
healthchecksPort: 8443
healthchecksScheme: HTTPS
# persistence将 /data 持久化,保证 acme.json 落盘
# 显式 local-path避免集群默认 StorageClass 为 longhorn 等未就绪时 Pod 长期 Pending
persistence:
enabled: true
name: data
accessMode: ReadWriteOnce
size: 128Mi
path: /data
storageClass: local-path
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
namespace: kube-system
spec:
entryPoints:
- web
routes:
- match: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
kind: Rule
services:
- name: api@internal
kind: TraefikService