diff --git a/docs/end-user/traits/rollout.md b/docs/end-user/traits/rollout.md index eed48c76..23822581 100644 --- a/docs/end-user/traits/rollout.md +++ b/docs/end-user/traits/rollout.md @@ -6,72 +6,44 @@ In this section, we will introduce how to canary rollout a container service. ## Before starting -1. Enable [`kruise-rollout`](../../reference/addons/kruise-rollout) addon, our canary rollout capability relies on the [rollouts from OpenKruise](https://github.com/openkruise/rollouts). - ```shell - vela addon enable kruise-rollout - ``` - -2. Please make sure one of the [ingress controllers](https://kubernetes.github.io/ingress-nginx/deploy/) is available in your cluster. - You can also enable the [`ingress-nginx`](../../reference/addons/nginx-ingress-controller) addon if you don't have any: - ```shell - vela addon enable ingress-nginx - ``` - Please refer to [the addon doc](../../reference/addons/nginx-ingress-controller) to get the access address of gateway. - -3. Some of the commands such as `rollback` relies on vela-cli `>=1.5.0-alpha.1`, please upgrade the command line for convenience. You don't need to upgrade the controller. - +Enable [`kruise-rollout`](../../reference/addons/kruise-rollout) addon, our canary rollout capability relies on the [rollouts from OpenKruise](https://github.com/openkruise/rollouts). +```shell +vela addon enable kruise-rollout + ``` ## First Time Deploy -When you want to use the canary rollout for every upgrade, you should **ALWAYS** have a `kruise-rollout` trait on your component. -The day-2 canary rollout of the component need you have this trait attached already. Deploy the application with traits like below: +Deploy the application as shown below: ```yaml cat </version @@ -118,39 +98,56 @@ cat </version @@ -196,13 +211,17 @@ After verify the success of the canary version through business-related metrics, vela workflow resume canary-demo ``` -Access the gateway endpoint again multi times. You will find out the chance (`90%`) to meet result `Demo: v2` is highly increased. +Access the gateway endpoint again multi times. You will find out the chance (`50%`) to meet result `Demo: v2` is highly increased. ```shell $ curl -H "Host: canary-demo.com" /version Demo: V2 ``` +View topology graph again, you will see the workload updated 3 replicas to `v2`, and this pod will serve the canary traffic. Meanwhile, 2 pods of `v1` are still running and server non-canary traffic. + +![image](../../resources/kruise-rollout-v2-batch2.jpg) + ## Canary validation succeed, finished the release In the end, you can resume again to finish the rollout process. @@ -222,21 +241,10 @@ Demo: V2 If you want to cancel the rollout process and rollback the application to the latest version, after manually check. You can rollback the rollout workflow: -You should suspend the workflow before rollback: - -```shell -$ vela workflow suspend canary-demo -Rollout default/canary-demo in cluster suspended. -Successfully suspend workflow: canary-demo -``` - -Then rollback: - ```shell $ vela workflow rollback canary-demo Application spec rollback successfully. Application status rollback successfully. -Rollout default/canary-demo in cluster rollback. Successfully rollback rolloutApplication outdated revision cleaned up. ``` @@ -248,3 +256,82 @@ Demo: V1 ``` Any rollback operation in middle of a runningWorkflow will rollback to the latest succeeded revision of this application. So, if you deploy a successful `v1` and upgrade to `v2`, but this version didn't succeed while you continue to upgrade to `v3`. The rollback of `v3` will automatically to `v1`, because release `v2` is not a succeeded one. + +## Perform canary rollout process on VelaUX + +You can also execute a Canary Rollout process on VelaUX. + +### First deployment + +To begin, create an application with a `webservice` component and set its image to `wangyikewyk/canarydemo:v1`, as shown in the image below: + +![image](../../resources/kruise-rollout-velaux-v1-component.jpg) + +Next, add a `scaler` trait for this component and set the replica number to 3, as shown below: + +![image](../../resources/kruise-rollout-velaux-v1-scaler.jpg) + +Finally, configure a gateway for the component and set the hostname and traffic route, as illustrated in the image: + +![image](../../resources/kruise-rollout-velaux-v1-gateway.jpg) + +After clicking the deploy button, the application will be deployed, and you can check its status on the `resource topology` page, as shown below: + +![image](../../resources/kruise-rollout-velaux-v1.jpg) + +### Day-2 Canary Release + +To update the component, change the image to `wangyikewyk/canarydemo:v2`: + +![image](../../resources/kruise-rollout-velaux-v2-component.jpg) + +Next, click the `deploy` button then click `Enable Canary Rollout` button to create a new canary rollout workflow, as shown below: + +![image](../../resources/kruise-rollout-velaux-enable-canary.jpg) + +Set the batches to 3 to perform a Canary Rollout of the application with 3 batches: + +![image](../../resources/kruise-rollout-velaux-batches-num.jpg) + +You will see the new created workflow is as shown below, click the `save` button to save it. + +![image](../../resources/kruise-rollout-velaux-canary-workflow.jpg) + +The rollout process is divided into three steps, with each step releasing 1/3 replicas and traffic to the new version. A manual approval step is between two `canary-deploy` steps. You can also modify the weight of every Canary Rollout step. + +Click deploy again and choose the `Default Canary Workflow` to begin the rollout process as shown: + +![image](../../resources/kruise-rollout-velaux-choose-wf.jpg) + +After the first step is complete, 1 replica will be updated to v2, as shown below: + +![image](../../resources/kruise-rollout-velaux-v2-batch1.jpg) + +You can try to access the gateway using the following command, and you will have a 1/3 chance of getting the `Demo: V1`. + +```shell +$ curl -H "Host: canary-demo.com" /version +Demo: V1 +``` + +### Continue rollout + +To continue the rollout process, click the `continue` button on the workflow page: + +![image](../../resources/kruise-rollout-velaux-v2-continue.jpg) + +You will find that 2 replicas have been updated to the new version: + +![image](../../resources/kruise-rollout-velaux-v2-batch2.jpg) + +### Rollback + +To terminate the rolling process and rollback the application to version v1, click the `rollback` button: + +![image](../../resources/kruise-rollout-velaux-v2-rollback.jpg) + +You will find that all replicas have been rolled back to v1: + +![image](../../resources/kruise-rollout-velaux-v1.jpg) + + diff --git a/docs/resources/kruise-rollout-v1.jpg b/docs/resources/kruise-rollout-v1.jpg index 6a3ad674..d3385204 100644 Binary files a/docs/resources/kruise-rollout-v1.jpg and b/docs/resources/kruise-rollout-v1.jpg differ diff --git a/docs/resources/kruise-rollout-v2-batch1.jpg b/docs/resources/kruise-rollout-v2-batch1.jpg new file mode 100644 index 00000000..ca557972 Binary files /dev/null and b/docs/resources/kruise-rollout-v2-batch1.jpg differ diff --git a/docs/resources/kruise-rollout-v2-batch2.jpg b/docs/resources/kruise-rollout-v2-batch2.jpg new file mode 100644 index 00000000..ab5d321c Binary files /dev/null and b/docs/resources/kruise-rollout-v2-batch2.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-batches-num.jpg b/docs/resources/kruise-rollout-velaux-batches-num.jpg new file mode 100644 index 00000000..f4dfd18b Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-batches-num.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-canary-workflow.jpg b/docs/resources/kruise-rollout-velaux-canary-workflow.jpg new file mode 100644 index 00000000..ec80d1b7 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-canary-workflow.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-choose-wf.jpg b/docs/resources/kruise-rollout-velaux-choose-wf.jpg new file mode 100644 index 00000000..1f9b87c9 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-choose-wf.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-enable-canary.jpg b/docs/resources/kruise-rollout-velaux-enable-canary.jpg new file mode 100644 index 00000000..0ea4d9df Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-enable-canary.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v1-component.jpg b/docs/resources/kruise-rollout-velaux-v1-component.jpg new file mode 100644 index 00000000..28b6deef Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v1-component.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v1-gateway.jpg b/docs/resources/kruise-rollout-velaux-v1-gateway.jpg new file mode 100644 index 00000000..beb7d894 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v1-gateway.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v1-scaler.jpg b/docs/resources/kruise-rollout-velaux-v1-scaler.jpg new file mode 100644 index 00000000..9069ec51 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v1-scaler.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v1.jpg b/docs/resources/kruise-rollout-velaux-v1.jpg new file mode 100644 index 00000000..d6ee450b Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v1.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v2-batch1.jpg b/docs/resources/kruise-rollout-velaux-v2-batch1.jpg new file mode 100644 index 00000000..b8f0d0f9 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v2-batch1.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v2-batch2.jpg b/docs/resources/kruise-rollout-velaux-v2-batch2.jpg new file mode 100644 index 00000000..8cb18161 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v2-batch2.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v2-component.jpg b/docs/resources/kruise-rollout-velaux-v2-component.jpg new file mode 100644 index 00000000..ad4a3428 Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v2-component.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v2-continue.jpg b/docs/resources/kruise-rollout-velaux-v2-continue.jpg new file mode 100644 index 00000000..a9bf026c Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v2-continue.jpg differ diff --git a/docs/resources/kruise-rollout-velaux-v2-rollback.jpg b/docs/resources/kruise-rollout-velaux-v2-rollback.jpg new file mode 100644 index 00000000..a6e886de Binary files /dev/null and b/docs/resources/kruise-rollout-velaux-v2-rollback.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/end-user/traits/rollout.md b/i18n/zh/docusaurus-plugin-content-docs/current/end-user/traits/rollout.md index 9a024b24..a51f4482 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/end-user/traits/rollout.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/end-user/traits/rollout.md @@ -6,74 +6,45 @@ title: 金丝雀发布 ## 准备工作 -1. 通过如下命令启用 [`kruise-rollout`](../../reference/addons/kruise-rollout) 插件,金丝雀发布依赖于 [rollouts from OpenKruise](https://github.com/openkruise/rollouts). +通过如下命令启用 [`kruise-rollout`](../../reference/addons/kruise-rollout) 插件,金丝雀发布依赖于 [rollouts from OpenKruise](https://github.com/openkruise/rollouts). - ```shell - vela addon enable kruise-rollout - ``` - -2. 请确保在集群中至少安装一种 [ingress controllers](https://kubernetes.github.io/ingress-nginx/deploy/)。 - 如果没有你也可以通过如下命令启用 [`ingress-nginx`](../../reference/addons/nginx-ingress-controller) 安装一个: - - ```shell - vela addon enable ingress-nginx - ``` - - 参考 [the addon doc](../../reference/addons/nginx-ingress-controller) 获取网关的访问地址。 - -3. 一些指令例如 `rollback` 依赖 vela-cli 版本 `>=1.5.0-alpha.1`,请升级cli到最新版本,不用升级Controller。 +```shell +vela addon enable kruise-rollout +``` ## 首次部署 -当你希望在每次升级策略配置时都使用金丝雀发布,**必须**在你的组件中添加 `kruise-rollout` 特性。 -在 day-2 金丝雀发布中组件必须已经存在此特性。部署应用: +对应用进行首次发布: ```yaml cat </version @@ -119,39 +99,55 @@ cat </version @@ -220,31 +236,99 @@ Demo: V2 ## 金丝雀验证失败,回滚 -如果经过验证发现新版本有问题,你想中断发布,将应用回滚至上一个版本。可以如下操作: - -你需要在回滚前中止工作流: - -```shell -$ vela workflow suspend canary-demo -Rollout default/canary-demo in cluster suspended. -Successfully suspend workflow: canary-demo -``` - -回滚: +如果经过验证发现新版本有问题,你想中断发布,将应用回滚至上一个版本。可以如下操作快速将应用回滚: ```shell $ vela workflow rollback canary-demo Application spec rollback successfully. Application status rollback successfully. -Rollout default/canary-demo in cluster rollback. Successfully rollback rolloutApplication outdated revision cleaned up. ``` -再次访问网关,你会看到结果一直是 `Demo: V1`。 +再次访问网关,你会看到结果一直是 `Demo: V1`: ```shell $ curl -H "Host: canary-demo.com" /version Demo: V1 ``` -需要注意的是,任何在应用处于 `runningWorkflow` 状态时的回滚操作,都会回滚到应用最后一次成功发布的版本,所以如果你已经成功部署了 `v1` 并且升级到 `v2`, 但是如果 `v2` 失败了但是你又继续更新到 `v3`。那么从 `v3` 回滚会自动到 `v1`,这是因为 `v2` 并不是成功发布的版本。 +需要注意的是,任何在应用处于发布中状态时的回滚操作,都会回滚到应用最后一次成功发布的版本,所以如果你已经成功部署了 `v1` 并且升级到 `v2`, 但是如果 `v2` 失败了但是你又继续更新到 `v3`。那么从 `v3` 回滚会自动到 `v1`,这是因为 `v2` 并不是成功发布的版本。 + +## 使用 VelaUX 做金丝雀发布 + +你也可以在 VelaUX 上对应用进行金丝雀方式的升级。 + +### 首次部署 + +首先在 VelaUX 界面上创建一个应用,其中包含了一个 `webservice` 类型的组件,并且将组件的镜像设置为 `wangyikewyk/canarydemo:v1` 如下图所示: + +![image](../../resources/kruise-rollout-velaux-v1-component.jpg) + +接下来为这个组件添加一个副本个数为 3 的 `scaler` 运维特征: + +![image](../../resources/kruise-rollout-velaux-v1-scaler.jpg) + +最后为组件添加一个 `gateway` 运维特征,并设置响应的路由规则,如下: + +![image](../../resources/kruise-rollout-velaux-v1-gateway.jpg) + +之后点击 `deploy` 按钮应用进行部署,之后你就可以在资源拓扑图页面中看到所有实例都已经被创建: + +![image](../../resources/kruise-rollout-velaux-v1.jpg) + +### 继续金丝雀发布 + +更新组件将镜像设置为 `wangyikewyk/canarydemo:v2`: + +![image](../../resources/kruise-rollout-velaux-v2-component.jpg) + +点击 `deploy` 按钮,并点击 `Enable Canary Rollout` 创建金丝雀发布的工作流,如下所示: + +![image](../../resources/kruise-rollout-velaux-enable-canary.jpg) + +这里我们可以将批次设置为 3,从而对应用分三个批次进行升级: + +![image](../../resources/kruise-rollout-velaux-batches-num.jpg) + +接下来可以看到新新创建的了一条金丝雀发布的工作流,点击 `save` 按钮对工作流进行保存,如下所示: + +![image](../../resources/kruise-rollout-velaux-canary-workflow.jpg) + +工作流包含三个 `canary-deploy`的步骤,说明整个发布过程被分为了三批进行发布,每个批次有升级 1/3 的实例到新版本,并且将 1/3 的流量导入到新版本。两个 `canary-deploy` 步骤间有一个人工确认的步骤。你也可以编辑 `canary-deploy` 的步骤来修改每个批次的发布比例。 + +再次点击 `Deploy` 按钮发布,并选择刚才创建的 `Default Canary Workflow` 工作流开始发布,如下所示: + +![image](../../resources/kruise-rollout-velaux-choose-wf.jpg) + +当第一步完成之后,可以看到有 1 个实例被升级到了新版本,如下所示: + +![image](../../resources/kruise-rollout-velaux-v2-batch1.jpg) + +你可以通过下面的命令访问应用网关,你将会发现大约有 1/3 的概率看到 `Demo: V1` 的结果: + +```shell +$ curl -H "Host: canary-demo.com" /version +Demo: V1 +``` + +### 继续发布 + +在工作流页面,点击 `continue` 按钮继续下面后面的发布步骤: + +![image](../../resources/kruise-rollout-velaux-v2-continue.jpg) + +之后你将会看到又有 2 个实例升级到新版本: + +![image](../../resources/kruise-rollout-velaux-v2-batch2.jpg) + +### 回滚 + +如果你想终止当前的发布工作流,并将应用的实例和流量回滚到发布钱的状态,可以在工作流的页面点击 `rollback` 按钮来进行这个操作: + +![image](../../resources/kruise-rollout-velaux-v2-rollback.jpg) + +接下来你将会发现所有的实例都回滚到了 v1版本: + +![image](../../resources/kruise-rollout-velaux-v1.jpg) + + diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-batches-num.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-batches-num.jpg new file mode 100644 index 00000000..f4dfd18b Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-batches-num.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-canary-workflow.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-canary-workflow.jpg new file mode 100644 index 00000000..ec80d1b7 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-canary-workflow.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-choose-wf.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-choose-wf.jpg new file mode 100644 index 00000000..1f9b87c9 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-choose-wf.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-enable-canary.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-enable-canary.jpg new file mode 100644 index 00000000..0ea4d9df Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-enable-canary.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-component.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-component.jpg new file mode 100644 index 00000000..28b6deef Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-component.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-gateway.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-gateway.jpg new file mode 100644 index 00000000..beb7d894 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-gateway.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-scaler.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-scaler.jpg new file mode 100644 index 00000000..9069ec51 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1-scaler.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1.jpg new file mode 100644 index 00000000..d6ee450b Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v1.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch1.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch1.jpg new file mode 100644 index 00000000..b8f0d0f9 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch1.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch2.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch2.jpg new file mode 100644 index 00000000..8cb18161 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-batch2.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-component.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-component.jpg new file mode 100644 index 00000000..ad4a3428 Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-component.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-continue.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-continue.jpg new file mode 100644 index 00000000..a9bf026c Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-continue.jpg differ diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-rollback.jpg b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-rollback.jpg new file mode 100644 index 00000000..a6e886de Binary files /dev/null and b/i18n/zh/docusaurus-plugin-content-docs/current/resources/kruise-rollout-velaux-v2-rollback.jpg differ