新应用金丝雀发布策略

Canary release strategy of new application

我有一个应用程序在 React 中有一些后端服务和 SPA 前端构建。

我想用 istio 发布一个金丝雀版本。我关心的是如何管理发布策略,其中-

  1. 我把一定量的流量传给前端
  2. 当后端请求从这个新的前端完成时,流量应该传递给新的后端服务。

对此最好的方法是什么?

VirtualService下的 istio 文档中有详细解释。

还有很好的简单解释和例子here:

Canary Deployments

A canary deployment is a strategy for safely rolling out a new version of a service. With Istio, you can use percentage-based traffic splitting to direct a small amount of traffic to the new version. Then you can run a canary analysis on v2 (like check latency and error rate), and finally direct more traffic at the new version until it's serving all traffic.

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

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: helloworld
spec:
  host: helloworld
  subsets:
  - name: v1
    labels:
      version: v1
  - name: v2
    labels:
      version: v2

更新:

根据 istio documentation.

使用基于散列的负载平衡,可以通过 DestinationRule 添加会话亲和性又名粘性会话

希望对您有所帮助。