Traefik¶
You can use the Traefik Proxy for traffic management with Argo Rollouts.
The TraefikService is the object that supports the ability for weighted round robin load balancing and traffic mirroring when using Traefik as ingress.
Note
Traefik is also supported via the Argo Rollouts Gateway API plugin.
Version Compatibility¶
Argo Rollouts supports Traefik v3 by default.
| Traefik Version | API Group | Configuration |
|---|---|---|
| v3 (Default) | traefik.io |
No extra configuration required. |
| v2 | traefik.containo.us |
Requires CLI override flags (see below). |
Overriding the Default¶
If you are using Traefik v2, you must configure the Rollouts controller to use the legacy API group. This is done by passing the following flags to the rollouts-controller binary:
--traefik-api-group=traefik.containo.us
--traefik-api-version=traefik.containo.us/v1alpha1
Failure to set these flags when using Traefik v2 will result in the controller attempting to communicate with traefik.io, which will fail.
How to integrate TraefikService with Argo Rollouts using it as weighted round robin load balancer¶
First, we need to create the TraefikService object using its ability for weighted round robin load balancing.
apiVersion: traefik.io/v1alpha1
kind: TraefikService
metadata:
name: traefik-service
spec:
weighted:
services:
- name: stable-rollout # k8s service name that you need to create for stable application version
port: 80
- name: canary-rollout # k8s service name that you need to create for new application version
port: 80
Notice, we don't specify the weight field. It is necessary to be synced with ArgoCD. If we specify this field and Argo Rollouts controller changes it, then the ArgoCD controller will notice it and will show that this resource is out of sync (if you are using Argo CD to manage your Rollout).
Secondly, we need to create the Argo Rollouts object.
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: rollouts-demo
spec:
replicas: 5
strategy:
canary:
canaryService: canary-rollout
stableService: stable-rollout
trafficRouting:
traefik:
weightedTraefikServiceName: traefik-service # specify traefikService resource name that we have created before
steps:
- setWeight: 30
- pause: {}
- setWeight: 40
- pause: {duration: 10}
- setWeight: 60
- pause: {duration: 10}
- setWeight: 80
- pause: {duration: 10}
...