Traefik

Traefik is a modern, cloud-native ingress controller for Kubernetes, supporting dynamic configuration, Let's Encrypt, and advanced routing. It is widely used in GitOps workflows for AKS, EKS, GKE, and on-prem clusters.


Why Use Traefik?

  • Simple, dynamic configuration (CRDs, YAML, Helm)

  • Native support for Let's Encrypt, mTLS, and advanced routing

  • Works with GitOps tools (ArgoCD, Flux) for declarative, auditable deployments

  • Real-time dashboard and metrics

  • Multi-cloud and hybrid ready


Installation (Helm)

Requirements:

  • Kubernetes 1.16+

  • Helm 3.9+

Add the Traefik Helm repo:

helm repo add traefik https://traefik.github.io/charts
helm repo update

Install Traefik in a dedicated namespace:


GitOps Setup Example (ArgoCD)

1. Add Traefik Helm chart to your Git repo:

2. Define an ArgoCD Application:

3. Apply the Application:


Exposing the Traefik Dashboard

Port-forward (default, secure):

Access at: http://127.0.0.1:9000/dashboard/

IngressRoute CRD Example:


Dynamic Routing Example


Pros and Cons

Pros
Cons

Easy dynamic config (CRDs, Helm)

Fewer built-in policies than NGINX

Native Let's Encrypt, mTLS

Smaller community than NGINX

Real-time dashboard

Some advanced features require CRDs

GitOps-friendly

May need tuning for high-traffic workloads

Multi-cloud support


2025 Best Practices

  • Use GitOps (ArgoCD, Flux) for all Traefik config and upgrades

  • Store all manifests and Helm values in Git (version control)

  • Use RBAC and network policies to secure Traefik

  • Enable HTTPS and automatic certificate management

  • Monitor with Prometheus/Grafana and enable dashboard access only for admins

  • Use LLMs (Copilot, Claude) to generate and review IngressRoute and middleware configs

Common Pitfalls

  • Exposing the dashboard publicly (security risk)

  • Not enabling HTTPS by default

  • Manual changes outside Git (causes drift in GitOps)

  • Not monitoring for sync errors or drift


References

Last updated