# Service weights for ingress objects

**URL:** <https://community.traefik.io/t/service-weights-for-ingress-objects/10186>\
**Category:** Traefik v2\
**Tags:** kubernetes-ingress\
**Created:** [March 26, 2021, 1:57pm UTC](https://community.traefik.io/t/service-weights-for-ingress-objects/10186 "2021-03-26T13:57:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paltryeffort](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/paltryeffort/32/3596_2.png) [@paltryeffort](https://community.traefik.io/u/paltryeffort)\
**Post date:** [March 26, 2021, 1:57pm UTC](https://community.traefik.io/t/service-weights-for-ingress-objects/10186/1 "2021-03-26T13:57:20Z")

</div>

I am using traefik 1.7 and I would like to migrate to traefik 2.x. On my ingress objects I use:

```auto
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?

---

<div class="post-metadata">

**Author:** ![jakubhajek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jakubhajek/32/3389_2.png) [@jakubhajek](https://community.traefik.io/u/jakubhajek)\
**Post date:** [March 26, 2021, 4:26pm UTC](https://community.traefik.io/t/service-weights-for-ingress-objects/10186/2 "2021-03-26T16:26:45Z")

</div>

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:

> <https://github.com/jakubhajek/traefik-kubernetescrd/blob/ff8e1934db135395b92e60778a3bed081881a187/03-canary-deployment/02-canary-webapp-V2/ingress-canary.yml#L8>

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,

---

<div class="post-metadata">

**Author:** ![SanthoshJaina](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@SanthoshJaina](https://community.traefik.io/u/SanthoshJaina)\
**Post date:** [February 1, 2024, 7:11am UTC](https://community.traefik.io/t/service-weights-for-ingress-objects/10186/3 "2024-02-01T07:11:15Z")

</div>

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](http://traefik.ingress.kubernetes.io/service-weights) which worked well with k8s ingress annotation.

annotations:  
[traefik.ingress.kubernetes.io/service-weights:](http://traefik.ingress.kubernetes.io/service-weights:) |  
app-prod: 100%  
failover: 0%
