github.com/oam-dev/kubevela@v1.9.11/docs/examples/canary-rollout-use-case/README.md (about) 1 # Canary rollout use case 2 3 This chapter will introduce how to define a canary rollout workflow to implement [bookinfo demo](https://istio.io/latest/docs/examples/bookinfo/?ie=utf-8&hl=en&docs-search=Canary) by leverage [istio](https://istio.io/latest/) 4 5 ## Prerequisite 6 7 enable istio addon in you cluster 8 ```shell 9 vela addon enable istio 10 ``` 11 12 enable label istio injection in `default namespace` 13 14 ```shell 15 kubectl label namespace default istio-injection=enabled 16 ``` 17 18 ## First deployment 19 20 ```shell 21 kubectl apply -f first-deploy.yaml 22 ``` 23 24 Wait a few minutes until all pods are ready. Use kubectl port-forward map gateway's service port to localhost. 25 ```shell 26 kubectl port-forward service/istio-ingressgateway -n istio-system 19082:80 27 ``` 28 29 Request http://127.0.0.1:19082/productpage in your browser will see webpage like this. 30  31 32 ## Canary Rollout 33 34 Update the Application to define a canary rollout workflow. 35 This workflow will suspend after rolling the first batch of new `reviews` pods and shift 10% traffic to new revision. 36 It waits for user to do manual-check. 37 38 ```shell 39 kubectl apply -f rollout-v2.yaml 40 ``` 41 42 Wait a few minutes new revision pods ready. Request http://127.0.0.1:19082/productpage in your browser again several times. Will see almost 90% chance see previous the webpage and 10% chance see the new webpage whose reviews will display red starts like this. 43 44  45 46 ### Rollout rest batches and traffic 47 48 resume workflow to continue rollout rest replicas and shift all traffic to new revision. 49 50 ```shell 51 vela workflow reumse book-info 52 ``` 53 54 Request again. You will always see the new webpage 55 56 ### Rollback to the first deployment 57 58 If you find some problems after manual-check and want to revert to previous revision, you can rollback to the first deployment. 59 60 ```shell 61 kubectl apply -f rollback.yaml 62 ``` 63 64 By request again. You will always see the old webpage 65 66 67 68 69