I am using traefik 1.7 and I would like to migrate to traefik 2.x. On my ingress objects I use:
annotations:
traefik.ingress.kubernetes.io/service-weights: |
app-prod: 30%
app-preprod: 70%
I understand that in traefik 2.x I should use TraefikService
for this. However, this only works with IngressRoute
but I am stuck with Ingress
objects. Is there any way to have service weights for Ingress objects and if not, are there any plans to implement such a feature?
Hello @paltryeffort
You are right, there is no such annotation available in v2. However, you can use TraefikService
and use a weighted load balancer between Kubernetes services. One of my old examples of how to do that you can find here:
Would you please share why Ingress is mandatory - please also note that you can use both: Kubernetes Ingress and Kubernetes IngressRoute with CRD.
Thank you,
Hi @jakubhajek ,
Let's say I have defined TraefikService as webapp-v1 weight: 1, webapp-v2 weight: 0,
May I know how it behaves when webapp-v1 down, will it still route the traefik to webapp-v2.
I am using latest traefik v2.10 TraefikProxy. I tried with 1,0 bit its not flipping to second service automatically.
The reason why I am asking in cluster we implemented failover capability from one cluster to another cluster using traefik.ingress.kubernetes.io/service-weights which worked well with k8s ingress annotation.
annotations:
traefik.ingress.kubernetes.io/service-weights: |
app-prod: 100%
failover: 0%