gpt4 book ai didi

kubernetes - Traefik负载平衡权重未按预期运行

转载 作者:行者123 更新时间:2023-12-02 11:39:30 25 4
gpt4 key购买 nike

我为traefik配置了以下入口,但是traefik会将所有流量发送到app-blue-release。理想情况下,它应该只将30%的流量发送到蓝色,将70%的流量发送到绿色,但是并没有按预期运行。

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
traefik.frontend.entryPoints: http
traefik.ingress.kubernetes.io/service-weights: |-
app-green-release: 70.0
app-blue-release: 30.0
creationTimestamp: 2019-06-04T06:00:37Z
generation: 2
labels:
app: traefik-app
name: traefik-app
namespace: mynamespace
resourceVersion: "645536328"
selfLink: /apis/extensions/v1beta1/namespaces/mynamespace/ingresses/traefik-app
uid: 4637377-747b-11e9-92ea-005056aeabf7
spec:
rules:
- host: mycompany2.com
http:
paths:
- backend:
serviceName: app-release
servicePort: 8080
- host: mycompany.com
http:
paths:
- backend:
serviceName: app-ui-release
servicePort: 80
path: /widget
- backend:
serviceName: app-green-release
servicePort: 8080
path: /
- backend:
serviceName: app-blue-release
servicePort: 8080
path: /
status:
loadBalancer: {}

我正在使用以下流量版本。
traefik:v1.7.11-alpine

之前,当配重配置为10(蓝色)和90(绿色)时,它就可以正常工作。但是,一旦我们分别更改为30和70,就会发生此问题。

任何人以前都曾遇到过这样的问题。谢谢您的帮助

最佳答案

似乎跟着traefik issue 4494(而不是您自己的issue 4940)

the annotation ingress.kubernetes.io/service-weights has been added in v1.7, before the annotation was ignored.



但是, as of June 11th, 2019,Damien Duportal(Træfik的开发人员倡导者)补充说:

There is no known workaround for now.
We are working on this, but as the version 2.0 of Traefik is currently worked on, we have to wait :)



这来自 PR 3112

Provides a new ingress annotation ingress.kubernetes.io/backend-weights which specifies a YAML-encoded, percentage-based weight distribution. With this annotation, we can do canary release by dynamically adjust the weight of ingress backends.



(最初在 commit 11f6079中重命名为 ingress.kubernetes.io/percentage-weights之前称为 ingress.kubernetes.io/service-weights)

该问题仍然悬而未决。
首先尝试升级到 v1.7.12-alpine,以检查问题是否仍然存在。

The example提到:
service_backend1: 1% # Note that the field names must match service names referenced in the Ingress object.
service_backend2: 33.33%
service_backend3: 33.33% # Same as 33.33%, the percentage sign is optional

因此,请尝试以下操作:
  app-green-release: 70%
app-blue-release: 30%

关于kubernetes - Traefik负载平衡权重未按预期运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56486759/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com