【问题标题】:Practical problems with canary rollout金丝雀推出的实际问题
【发布时间】:2021-08-02 13:28:14
【问题描述】:

我正在考虑在 Istio 中使用金丝雀部署,但它似乎会根据权重将请求随机分配到新旧版本。这意味着业务中的用户可能会在一分钟看到一种行为,下一分钟会看到不同的行为,团队中的人可能会遇到彼此不同的行为。出于这个原因,如果我希望用户或团队的行为保持一致,我需要建立自己的推出机制,我可以控制谁继续使用新的服务版本。

我是正确的还是我误解了 Istio 金丝雀推出的工作原理?

【问题讨论】:

    标签: istio canary-deployment


    【解决方案1】:

    如果你按权重做一个基本的流量分配,你是对的。

    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: helloworld
    spec:
      hosts:
        - helloworld
      http:
      - route:
        - destination:
            host: helloworld
            subset: v1
          weight: 90
        - destination:
            host: helloworld
            subset: v2
          weight: 10
    

    这里有 10% 的流量被随机路由到 v2。任何请求都可能调用不同的版本。

    但是你可以做更复杂的路由。

    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: helloworld
    spec:
      hosts:
        - helloworld
      http:
      - match:
        - headers:
            group:
              exact: testing
        route:
        - destination:
            host: helloworld
            subset: v2
      - route:
        - destination:
            host: helloworld
            subset: v1
    

    现在有两条路线:

    • 标头 group=testing 的用户将被发送到 v2
    • 所有其他用户将被发送到 v1

    此示例中的标头可以根据用户在前端设置,因此该用户的后端请求将调用 v2。

    或者您可以为特定组设置一个 cookie,并使用以下方式将它们路由到不同的前端:

    - match:
        - headers:
            cookie: 
               [...]
    

    multiple match条件,包括headersqueryParamsauthority

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-01
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多