Traefik — Ingress Controller
Traefik is the ingress controller for this cluster. It handles all inbound HTTP/HTTPS traffic, TLS termination, and routing to backend services.
k3s ships with Traefik by default, but this repo disables the built-in Traefik (--disable=traefik) and installs it via Helm for full configuration control.
What Traefik does here
| Responsibility | Detail |
|---|---|
| Ingress controller | Routes traffic to services via IngressRoute CRDs |
| TLS termination | Handles HTTPS using certificates from cert-manager |
| Dashboard | Secured admin UI at DASHBOARD_DOMAIN |
| Metrics | Exposes Prometheus metrics on port 9100 |
| Access logs | JSON-formatted access logs |
Helm install
Traefik is installed from the platform-traefik wrapper chart, which pins the upstream traefik subchart (and so the proxy version) in its Chart.yaml:
helm upgrade --install traefik oci://ghcr.io/kevindebenedetti/charts/platform-traefik \
--version <k3s-lab release, e.g. 0.24.1> \
--namespace ingress \
--create-namespace \
--set 'traefik.service.spec.externalIPs={<server public IP>}'
traefik.service.spec.externalIPspins the LoadBalancer Service to the server node's public IP. The Service settings live underservice.spec: since subchart 42.4.0 the chart's values schema rejects keys placed directly underservice(service.type,service.externalIPs), which older versions silently ignored. The subchart version, the deployed proxy version and the advisory history are in the chart README.
Values explained (charts/platform-base/values.yaml)
EntryPoints
| EntryPoint | Port | Exposed | Purpose |
|---|---|---|---|
web | 8000 | 80 | HTTP traffic |
websecure | 8443 | 443 | HTTPS + TLS |
metrics | 9100 | No | Internal metrics endpoint |
No global HTTP→HTTPS redirect. A global redirect on the
webentrypoint would intercept cert-manager's HTTP-01 ACME challenge before the solver can respond, breaking TLS issuance. Use a per-routeredirectSchememiddleware instead.
TLS hardening
TLS 1.0 and 1.1 are disabled. Only strong cipher suites are allowed:
tlsOptions:
default:
minVersion: VersionTLS12
cipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
- TLS_CHACHA20_POLY1305_SHA256
sniStrict: trueSecurity context
Traefik runs as a non-root user (runAsUser: 65532) with a read-only filesystem and dropped capabilities (except NET_BIND_SERVICE for low ports).
Prometheus metrics
Traefik serves its Prometheus metrics on the metrics entry point (port 9100, path /metrics).
The chart renders no ServiceMonitor: traefik.metrics.prometheus.serviceMonitor.enabled stays at the subchart's default, false, so the kube-prometheus-stack Prometheus Operator does not discover Traefik on its own. A Traefik-only cluster has no monitoring.coreos.com CRDs, and the subchart refuses to render a ServiceMonitor without them.
To have Prometheus scrape Traefik, turn it on in the values you install the chart with:
traefik:
metrics:
prometheus:
# The ServiceMonitor selects this dedicated `traefik-metrics` Service.
service:
enabled: true
serviceMonitor:
enabled: true
# The label your Prometheus selects ServiceMonitors by. With
# kube-prometheus-stack's defaults it is the Helm release name of
# that chart; platform-security's Kyverno ServiceMonitor uses the same.
additionalLabels:
release: prometheusThe subchart fails the render (You have to deploy monitoring.coreos.com/v1 first) when the Prometheus Operator CRDs are not installed yet. Install platform-monitoring first, or set traefik.metrics.prometheus.disableAPICheck: true when the CRDs arrive in the same sync.
Dashboard
The Traefik dashboard is exposed via a secured IngressRoute at DASHBOARD_DOMAIN.
Create the BasicAuth secret (run once)
task deploy:dashboard-secretThis runs:
kubectl create secret generic traefik-dashboard-auth \
--from-literal=users="$(htpasswd -nb admin <DASHBOARD_PASSWORD>)" \
-n ingressUsername is always
admin. Password is set viaDASHBOARD_PASSWORDin.env.
IngressRoute manifest
The dashboard manifest is managed via ArgoCD or your consuming repo's platform/ directory. It creates:
dashboard-basicauthMiddleware — enforces HTTP Basic Authenticationdashboard-redirect-schemeMiddleware — HTTP → HTTPS redirecttraefik-dashboardIngressRoute — routesDASHBOARD_DOMAIN/dashboardand/apitoapi@internaltraefik-dashboard-tlsCertificate — cert-manager issues a Let's Encrypt certificate
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
namespace: ingress
spec:
entryPoints:
- websecure
routes:
- match: Host(`${DASHBOARD_DOMAIN}`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
kind: Rule
middlewares:
- name: dashboard-basicauth
namespace: ingress
services:
- name: api@internal
kind: TraefikService
tls:
secretName: traefik-dashboard-tlsDeploying your own services
To expose a service via Traefik, create an IngressRoute:
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: my-app
namespace: apps
spec:
entryPoints:
- websecure
routes:
- match: Host(`app.example.com`)
kind: Rule
services:
- name: my-app-svc
port: 80
tls:
secretName: my-app-tls
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: my-app-tls
namespace: apps
spec:
secretName: my-app-tls
issuerRef:
name: letsencrypt-production
kind: ClusterIssuer
dnsNames:
- app.example.comSee Kustomize components for a complete example.